js: fixing Key import/export test

--

* BrowserTestExtension:
 - The KeyImport/Export test had some errors, which have now been fixed
 - The secret key used for the test examples is now placed more
   prominently, and a clarification added that decrypt tests will not
   work if this key is not imported.

* permittedOperations.js: typo

  Thanks to rrenkert@intevation.de for the fixes
This commit is contained in:
Maximilian Krambach 2018-07-03 12:41:49 +02:00
parent 88e7f8ec2e
commit a52ec87d40
3 changed files with 87 additions and 13 deletions

View File

@ -23,6 +23,15 @@
The functionality tests, to be found in
gpgme/lang/js/BrowserTestExtension, check the overall functionality of
the standard packaged version of gpgmejs.
</p>
<p>
Most tests rely on a test gpg key to be available in gpg, which can be
found at the bottom of this page, or as "testkey.sec" in the
BrowserTestExtension's directory. Please import this key to your tested
gpg installation, or adapt the input defined in tests/inputvalues.js
if you want to use different values.
</p>
<p>
<ul>
<li>
<a href="browsertest.html">
@ -36,5 +45,69 @@
</li>
</ul>
</p>
<hr />
<p>
<textarea rows="5" cols="65" wrap="hard" readonly>
-----BEGIN PGP PRIVATE KEY BLOCK-----
lQOYBFrsKEkBCADKw4Wt8J6M/88qD8PO6lSMCxH1cpwH8iK0uPaFFYsJkkXo7kWf
PTAtrV+REqF/o80dvYcdLvRsV21pvncZz/HXLu1yQ18mC3XObrKokbdgrTTKA5XE
BZkNsqyaMMJauT18H4hYkSg62/tTdO1cu/zWv/LFf7Xyn6+uA74ovXCJlO1s0N2c
PShtr98QRzPMf2owgVk37JnDNp4gGVDGHxSZOuUwxgYAZYnA8SFc+c+3ZrQfY870
+O4j3Mz4p7yD13AwP4buQLBsb/icxekeQCqpRJhLH9f7MdEcGXa1x36RcEkHdu+M
yJ392eMgD+dKNfRCtyTPhjZTxvbNELIBYICfABEBAAEAB/wLJ0gyMjs2fFfT83wM
5Lzz2yQIwV4t3bblBAujdHTqeN5Zmsm/oakFyjSokULK96Kv0R4ej9eoIgMFvxFk
HRkrggxTrbsNJ7I6QcKYHTPeIIj318ykNL6fj0WJUcdPIENukXl5jbqNyk3/4D2y
TTDySyq6jHT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0wU2b5GMnZbY/06HENpidIzpa231VQaw5/nPTvfhlLKW1iGAkc148cX1q
lL9w2ksXuaHR3LXud2VcfVTIdxU/7h7u1dD/85+c0+7jlGObD9cXKxlM6OjpIJz1
l5/1h3C5S0TuxHkEAL/3BGihkhNfv1Xx0rWu0/732usX/nE/A9C26hGu41FUf3fp
0ilonKpKZUEwWt5hWSEFCSrznNVekiO0rxvuu3RVegvzThPNU4Pf4JZtJpRVhvUQ
d9ulxJw7V9rs75uNBatTNC0kXuGoXhehw4Bn93xa67gYGd3LfrH+oT0GCDpTSHCJ
ATwEGAEIACYWIQTUFzW5Ejb9uIIEjFojAWNe7/DLBQUCWuwoSQIbDAUJA8JnAAAK
CRAjAWNe7/DLBf0pCACPp5hBuUWngu2Hqvg+tNiujfsiYzId3MffFxEk3CbXeHcJ
5F32NDJ9PYCnra4L8wSv+NZt9gIa8lFwoFSFQCjzH7KE86XcV3MhfdJTNb/+9CR7
Jq3e/4Iy0N5ip7PNYMCyakcAsxvsNCJKrSaDuYe/OAoTXRBtgRWE2uyT315em02L
kr+2Cc/Qk6H+vlNOHGRgnpI/OZZjnUuUfBUvMGHr1phW+y7aeymC9PnUGdViRdJe
23nntMSDA+0/I7ESO9JsWvJbyBmuiZpu9JjScOjYH9xpQLqRNyw4WHpZriN69F0t
9Mmd7bM1+UyPgbPEr0iWMeyctYsuOLeUyQKMscDT
=hkUm
-----END PGP PRIVATE KEY BLOCK-----
</textarea>
</p>
</body>
</html>

View File

@ -19,6 +19,7 @@
*
* Author(s):
* Maximilian Krambach <mkrambach@intevation.de>
* Raimund Renkert <rrenkert@intevation.de>
*/
/* global describe, it, expect, Gpgmejs, ImportablePublicKey */
@ -53,27 +54,27 @@ describe('Key importing', function () {
expect(result.length).to.equal(0);
context.Keyring.importKey(ImportablePublicKey.key, true)
.then(function(result){
expect(result[0]).to.not.be.undefined;
expect(result[0].key).to.be.an('object');
expect(result[0].key.fingerprint).to.equal(
expect(result.Keys[0]).to.not.be.undefined;
expect(result.Keys[0].key).to.be.an('object');
expect(result.Keys[0].key.fingerprint).to.equal(
ImportablePublicKey.fingerprint);
expect(result[0].status).to.equal('newkey');
expect(result.Keys[0].status).to.equal('newkey');
context.Keyring.importKey(
ImportablePublicKey.keyChangedUserId,true)
.then(function(res){
expect(res[0]).to.not.be.undefined;
expect(res[0].key).to.be.an('object');
expect(res[0].key.fingerprint).to.equal(
expect(res.Keys[0]).to.not.be.undefined;
expect(res.Keys[0].key).to.be.an('object');
expect(res.Keys[0].key.fingerprint).to.equal(
ImportablePublicKey.fingerprint);
expect(res[0].status).to.equal(
expect(res.Keys[0].status).to.equal(
'change');
expect(
res[0].changes.userId).to.be.true;
res.Keys[0].changes.userId).to.be.true;
expect(
res[0].changes.subkey).to.be.false;
res.Keys[0].changes.subkey).to.be.false;
expect(
res[0].changes.signature).to.be.true;
res[0].key.delete().then(function(result){
res.Keys[0].changes.signature).to.be.true;
res.Keys[0].key.delete().then(function(result){
expect(result).to.be.true;
done();
});

View File

@ -272,7 +272,7 @@ export const permittedOperations = {
answer: {
type: [],
data: {
'result': 'Object'
'result': 'object'
}
}
},