Browse Source

P4TB-108 rename q -> queue as requested in the review

1.1.101
francesco 3 years ago
parent
commit
ce1ef17cf4
16 changed files with 147 additions and 147 deletions
  1. +2
    -2
      tests/boilerplate.js
  2. +17
    -17
      tests/features/encrypt_feature_spec.js
  3. +21
    -21
      tests/features/get_ongoing_message_rating_feature.js
  4. +7
    -7
      tests/features/get_trustwords_feature_spec.js
  5. +7
    -7
      tests/features/get_version_feature_spec.js
  6. +7
    -7
      tests/features/identity_rating_feature_spec.js
  7. +9
    -9
      tests/features/is_pEp_user_feature_spec.js
  8. +7
    -7
      tests/features/key_mistrusted_feature_spec.js
  9. +7
    -7
      tests/features/key_reset_trust_feature_spec.js
  10. +9
    -9
      tests/features/myself_feature_spec.js
  11. +7
    -7
      tests/features/trust_personal_key_feature_spec.js
  12. +7
    -7
      tests/features/update_identity_feature_spec.js
  13. +2
    -2
      tests/legacy-features/decrypt_mime_feature_spec.js
  14. +3
    -3
      tests/legacy-features/get_mime_decode_message_feature.js
  15. +9
    -9
      tests/mock.js
  16. +26
    -26
      tests/unit/controller.js

+ 2
- 2
tests/boilerplate.js View File

@ -3,7 +3,7 @@
// case the `before` part would probably be part of its constructor
// and this file could be deleted
module.exports = {
getController: function (q) {
getController: function (queue) {
pEp = require('../chrome/content/modules/pEp');
let pEpAdapter = require('../chrome/content/modules/pEpAdapter');
let pEpServer = require('../chrome/content/modules/pEpServer');
@ -17,7 +17,7 @@ module.exports = {
security_token: "0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW"
};
};
server = new pEpServer(console.log, connectionInfoDetector, q);
server = new pEpServer(console.log, connectionInfoDetector, queue);
let adapter = new pEpAdapter(console.log, server);
pEp.exists = false;
controller = new pEp([], console.log, adapter, fs, os);


+ 17
- 17
tests/features/encrypt_feature_spec.js View File

@ -6,16 +6,16 @@ let pEp = require('../../chrome/content/modules/pEp');
describe('pEp Encrypt Feature', () => {
let getQ = require('../mock').getQ;
let getQueue = require('../mock').getQueue;
let getController = require('../boilerplate').getController;
let b, q, pEpController;
let b, queue, pEpController;
describe('Without having public key', () => {
let result, message;
before(() => {
q = getQ();
pEpController = getController(q);
q.respondWith({"jsonrpc":"2.0","id":1,"result":{"outParams":[null],"return":{"status":1024,"hex":"0x400 \"PEP_UNENCRYPTED\""},"errorstack":["(1 elements cleared)"]}});
queue = getQueue();
pEpController = getController(queue);
queue.respondWith({"jsonrpc":"2.0","id":1,"result":{"outParams":[null],"return":{"status":1024,"hex":"0x400 \"PEP_UNENCRYPTED\""},"errorstack":["(1 elements cleared)"]}});
from = "cfg@pep.security";
to = "to@test.com";
@ -27,12 +27,12 @@ describe('pEp Encrypt Feature', () => {
result = pEpController.encryptMail(subject, body, "", from, to);
});
after(() => {
q.after();
queue.after();
pEpController.after();
});
it('should become the same message', () => {
q.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"encrypt_message","params":[{"id":"pEp-0","shortmsg":"subject","longmsg":"Not Encrypted Message","longmsg_formatted":"","from":{"user_id":"","username":"anonymous","address":"cfg@pep.security"},"to":[{"user_id":"","username":"anonymous","address":"to@test.com"}],"dir":1,"enc_format":3,"attachments":[],"opt_fields":[],"cc":[]},[],["OP"],3,0],"id":1,"jsonrpc":"2.0"});
queue.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"encrypt_message","params":[{"id":"pEp-0","shortmsg":"subject","longmsg":"Not Encrypted Message","longmsg_formatted":"","from":{"user_id":"","username":"anonymous","address":"cfg@pep.security"},"to":[{"user_id":"","username":"anonymous","address":"to@test.com"}],"dir":1,"enc_format":3,"attachments":[],"opt_fields":[],"cc":[]},[],["OP"],3,0],"id":1,"jsonrpc":"2.0"});
return result.should.become(message);
});
});
@ -40,10 +40,10 @@ describe('pEp Encrypt Feature', () => {
describe('Perfect scenario', () => {
let from, to, subject, body, message;
before(() => {
q = getQ();
pEpController = getController(q);
queue = getQueue();
pEpController = getController(queue);
q.respondWith({"jsonrpc":"2.0","id":2,"result":{"outParams":[{"dir":1,"id":"pEp.PXRZLM.16E95EA7JPDTS.BEFBAEC0-94DC-4AA2-A239-FE24BAA73911@pep.security","shortmsg":"p≡p","longmsg":"this message was encrypted with p≡p https://pEp-project.org","attachments":[{"value":"VmVyc2lvbjogMQ==","size":10,"mime_type":"application/pgp-encrypted"},{"value":"mockvalue","size":3681,"mime_type":"application/octet-stream","filename":"file://msg.asc"}],"from":{"address":"cfg@pep.security","fpr":"B5313A3FBF6720F2A421F8B3B8C7ED6CD7FF61B5","user_id":"pEp_own_userId","username":"anonymous","comm_type":255},"to":[{"address":"cfg@pep.security","fpr":"B5313A3FBF6720F2A421F8B3B8C7ED6CD7FF61B5","user_id":"pEp_own_userId","username":"anonymous","comm_type":255}],"opt_fields":[{"key":"X-pEp-Version","value":"2.1"}],"enc_format":3}],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
queue.respondWith({"jsonrpc":"2.0","id":2,"result":{"outParams":[{"dir":1,"id":"pEp.PXRZLM.16E95EA7JPDTS.BEFBAEC0-94DC-4AA2-A239-FE24BAA73911@pep.security","shortmsg":"p≡p","longmsg":"this message was encrypted with p≡p https://pEp-project.org","attachments":[{"value":"VmVyc2lvbjogMQ==","size":10,"mime_type":"application/pgp-encrypted"},{"value":"mockvalue","size":3681,"mime_type":"application/octet-stream","filename":"file://msg.asc"}],"from":{"address":"cfg@pep.security","fpr":"B5313A3FBF6720F2A421F8B3B8C7ED6CD7FF61B5","user_id":"pEp_own_userId","username":"anonymous","comm_type":255},"to":[{"address":"cfg@pep.security","fpr":"B5313A3FBF6720F2A421F8B3B8C7ED6CD7FF61B5","user_id":"pEp_own_userId","username":"anonymous","comm_type":255}],"opt_fields":[{"key":"X-pEp-Version","value":"2.1"}],"enc_format":3}],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
from = "cfg@pep.security";
to = "cfg@pep.security";
@ -52,12 +52,12 @@ describe('pEp Encrypt Feature', () => {
result = pEpController.encryptMail(subject, body, "", from, to);
});
after(() => {
q.after();
queue.after();
pEpController.after();
});
it('sends as expected', () => {
q.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"encrypt_message","params":[{"id":"pEp-0","shortmsg":"subject","longmsg":"Not Encrypted Message","longmsg_formatted":"","from":{"user_id":"","username":"anonymous","address":"cfg@pep.security"},"to":[{"user_id":"","username":"anonymous","address":"cfg@pep.security"}],"dir":1,"enc_format":3,"attachments":[],"opt_fields":[],"cc":[]},[],["OP"],3,0],"id":1,"jsonrpc":"2.0"});
queue.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"encrypt_message","params":[{"id":"pEp-0","shortmsg":"subject","longmsg":"Not Encrypted Message","longmsg_formatted":"","from":{"user_id":"","username":"anonymous","address":"cfg@pep.security"},"to":[{"user_id":"","username":"anonymous","address":"cfg@pep.security"}],"dir":1,"enc_format":3,"attachments":[],"opt_fields":[],"cc":[]},[],["OP"],3,0],"id":1,"jsonrpc":"2.0"});
});
it('should resolve into an encrypted mail', () => {
@ -129,10 +129,10 @@ describe('pEp Encrypt Feature', () => {
describe('Multiple recivers', () => {
let from, to, subject, body, cc, bcc;
before(() => {
q = getQ();
pEpController = getController(q);
queue = getQueue();
pEpController = getController(queue);
q.respondWith({"jsonrpc":"2.0","id":1,"result":{"outParams":[{"dir":1,"id":"pEp-0","shortmsg":"p≡p","longmsg":"this message was encrypted with p≡p https://pEp-project.org","attachments":[{"value":"VmVyc2lvbjogMQ==","size":10,"mime_type":"application/pgp-encrypted"},{"value":"mocked value","size":5071,"mime_type":"application/octet-stream","filename":"file://msg.asc"}],"from":{"address":"fo@pep.security","fpr":"B0E03850E2033BCBBF22F7087D45E0D0A78160AC","user_id":"pEp_own_userId","username":"anonymous","comm_type":255},"to":[{"address":"cfg@pep.security","fpr":"B5313A3FBF6720F2A421F8B3B8C7ED6CD7FF61B5","user_id":"pEp_own_userId","username":"anonymous","comm_type":255},{"address":"rg@pep.security","fpr":"14120CA823EA419E6A297EEDE37AADE4CCFDFBAD","user_id":"TOFU_rg@pep.security","username":"anonymous","comm_type":56}],"cc":[{"address":"kinga@pep-security.net","fpr":"B49167205B22B4891CD69580A1D55C3A106407CF","user_id":"TOFU_kinga@pep-security.net","username":"anonymous","comm_type":56}],"opt_fields":[{"key":"X-pEp-Version","value":"2.1"}],"enc_format":3}],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
queue.respondWith({"jsonrpc":"2.0","id":1,"result":{"outParams":[{"dir":1,"id":"pEp-0","shortmsg":"p≡p","longmsg":"this message was encrypted with p≡p https://pEp-project.org","attachments":[{"value":"VmVyc2lvbjogMQ==","size":10,"mime_type":"application/pgp-encrypted"},{"value":"mocked value","size":5071,"mime_type":"application/octet-stream","filename":"file://msg.asc"}],"from":{"address":"fo@pep.security","fpr":"B0E03850E2033BCBBF22F7087D45E0D0A78160AC","user_id":"pEp_own_userId","username":"anonymous","comm_type":255},"to":[{"address":"cfg@pep.security","fpr":"B5313A3FBF6720F2A421F8B3B8C7ED6CD7FF61B5","user_id":"pEp_own_userId","username":"anonymous","comm_type":255},{"address":"rg@pep.security","fpr":"14120CA823EA419E6A297EEDE37AADE4CCFDFBAD","user_id":"TOFU_rg@pep.security","username":"anonymous","comm_type":56}],"cc":[{"address":"kinga@pep-security.net","fpr":"B49167205B22B4891CD69580A1D55C3A106407CF","user_id":"TOFU_kinga@pep-security.net","username":"anonymous","comm_type":56}],"opt_fields":[{"key":"X-pEp-Version","value":"2.1"}],"enc_format":3}],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
from = "fo@pep.security";
to = ["cfg@pep.security", "rg@pep.security"];
@ -143,12 +143,12 @@ describe('pEp Encrypt Feature', () => {
result = pEpController.encryptMail(subject, body, "", from, to, cc);
});
after(() => {
q.after();
queue.after();
pEpController.after();
});
it('sends as expected', () => {
q.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"encrypt_message","params":[{"id":"pEp-0","shortmsg":"subject","longmsg":"Not Encrypted Message","longmsg_formatted":"","from":{"user_id":"","username":"anonymous","address":"fo@pep.security"},"to":[{"user_id":"","username":"anonymous","address":"cfg@pep.security"},{"user_id":"","username":"anonymous","address":"rg@pep.security"}],"dir":1,"enc_format":3,"attachments":[],"opt_fields":[],"cc":[{"user_id":"","username":"anonymous","address":"kinga@pep-security.net"}]},[],["OP"],3,0],"id":1,"jsonrpc":"2.0"});
queue.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"encrypt_message","params":[{"id":"pEp-0","shortmsg":"subject","longmsg":"Not Encrypted Message","longmsg_formatted":"","from":{"user_id":"","username":"anonymous","address":"fo@pep.security"},"to":[{"user_id":"","username":"anonymous","address":"cfg@pep.security"},{"user_id":"","username":"anonymous","address":"rg@pep.security"}],"dir":1,"enc_format":3,"attachments":[],"opt_fields":[],"cc":[{"user_id":"","username":"anonymous","address":"kinga@pep-security.net"}]},[],["OP"],3,0],"id":1,"jsonrpc":"2.0"});
});
it('should resolve into an encrypted mail', () => {


+ 21
- 21
tests/features/get_ongoing_message_rating_feature.js View File

@ -6,26 +6,26 @@ chai.should();
describe('pEp Get Ongoing Message Rating Feature', () => {
let getController = require('../boilerplate').getController;
let getQ = require('../mock').getQ;
let q, pEpController;
let getQueue = require('../mock').getQueue;
let queue, pEpController;
before(() => {
q = getQ();
pEpController = getController(q);
queue = getQueue();
pEpController = getController(queue);
});
after(() => {
q.after();
queue.after();
pEpController.after();
});
describe('Perfect scenario', () => {
let result = "initial value";
before(() => {
q.respondWith({"jsonrpc":"2.0","id":3,"result":{"outParams":[{"rating":3}],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
queue.respondWith({"jsonrpc":"2.0","id":3,"result":{"outParams":[{"rating":3}],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
result = pEpController.getOngoingRating("cfg@pep.security", ["cfg@pep.security"]);
});
it('should return a Object', () => {
q.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"outgoing_message_rating","params":[{"id":"pEp-0","shortmsg":"test","longmsg":"test","from":{"user_id":"","username":"anonymous","address":"cfg@pep.security"},"to":[{"user_id":"","username":"anonymous","address":"cfg@pep.security"}],"dir":1,"enc_format":3,"attachments":[],"opt_fields":[]},"0"],"id":1,"jsonrpc":"2.0"});
queue.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"outgoing_message_rating","params":[{"id":"pEp-0","shortmsg":"test","longmsg":"test","from":{"user_id":"","username":"anonymous","address":"cfg@pep.security"},"to":[{"user_id":"","username":"anonymous","address":"cfg@pep.security"}],"dir":1,"enc_format":3,"attachments":[],"opt_fields":[]},"0"],"id":1,"jsonrpc":"2.0"});
return result.should.become(3);
});
});
@ -33,12 +33,12 @@ describe('pEp Get Ongoing Message Rating Feature', () => {
describe('Perfect scenario 2', () => {
let result = "initial value";
before(() => {
q.respondWith({"jsonrpc":"2.0","id":3,"result":{"outParams":[{"rating":3}],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
queue.respondWith({"jsonrpc":"2.0","id":3,"result":{"outParams":[{"rating":3}],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
result = pEpController.getOngoingRating("cfg@pep.security", ["hk@pep.security"]);
});
it('should return a Object', () => {
q.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"outgoing_message_rating","params":[{"id":"pEp-0","shortmsg":"test","longmsg":"test","from":{"user_id":"","username":"anonymous","address":"cfg@pep.security"},"to":[{"user_id":"","username":"anonymous","address":"cfg@pep.security"}],"dir":1,"enc_format":3,"attachments":[],"opt_fields":[]},"0"],"id":1,"jsonrpc":"2.0"});
queue.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"outgoing_message_rating","params":[{"id":"pEp-0","shortmsg":"test","longmsg":"test","from":{"user_id":"","username":"anonymous","address":"cfg@pep.security"},"to":[{"user_id":"","username":"anonymous","address":"cfg@pep.security"}],"dir":1,"enc_format":3,"attachments":[],"opt_fields":[]},"0"],"id":1,"jsonrpc":"2.0"});
return result.should.become(3);
});
});
@ -46,12 +46,12 @@ describe('pEp Get Ongoing Message Rating Feature', () => {
describe('Perfect scenario 3', () => {
let result = "initial value";
before(() => {
q.respondWith({"jsonrpc":"2.0","id":3,"result":{"outParams":[{"rating":3}],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
queue.respondWith({"jsonrpc":"2.0","id":3,"result":{"outParams":[{"rating":3}],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
result = pEpController.getOngoingRating("cfg@pep.security", [{address: "hk@pep.security", username: ""}]);
});
it('should return a Object', () => {
q.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"outgoing_message_rating","params":[{"id":"pEp-0","shortmsg":"test","longmsg":"test","from":{"user_id":"","username":"anonymous","address":"cfg@pep.security"},"to":[{"user_id":"","username":"anonymous","address":"cfg@pep.security"}],"dir":1,"enc_format":3,"attachments":[],"opt_fields":[]},"0"],"id":1,"jsonrpc":"2.0"});
queue.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"outgoing_message_rating","params":[{"id":"pEp-0","shortmsg":"test","longmsg":"test","from":{"user_id":"","username":"anonymous","address":"cfg@pep.security"},"to":[{"user_id":"","username":"anonymous","address":"cfg@pep.security"}],"dir":1,"enc_format":3,"attachments":[],"opt_fields":[]},"0"],"id":1,"jsonrpc":"2.0"});
return result.should.become(3);
});
});
@ -59,12 +59,12 @@ describe('pEp Get Ongoing Message Rating Feature', () => {
describe('Empty to', () => {
let result = "initial value";
before(() => {
q.respondWith({"jsonrpc":"2.0","id":3,"result":{"outParams":[{"rating":3}],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
queue.respondWith({"jsonrpc":"2.0","id":3,"result":{"outParams":[{"rating":3}],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
result = pEpController.getOngoingRating("cfg@pep.security", [{}]);
});
it('should return a Object', () => {
q.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"outgoing_message_rating","params":[{"id":"pEp-0","shortmsg":"test","longmsg":"test","from":{"user_id":"","username":"anonymous","address":"cfg@pep.security"},"to":[{"user_id":"","username":"anonymous","address":"cfg@pep.security"}],"dir":1,"enc_format":3,"attachments":[],"opt_fields":[]},"0"],"id":1,"jsonrpc":"2.0"});
queue.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"outgoing_message_rating","params":[{"id":"pEp-0","shortmsg":"test","longmsg":"test","from":{"user_id":"","username":"anonymous","address":"cfg@pep.security"},"to":[{"user_id":"","username":"anonymous","address":"cfg@pep.security"}],"dir":1,"enc_format":3,"attachments":[],"opt_fields":[]},"0"],"id":1,"jsonrpc":"2.0"});
return result.should.become(0);
});
});
@ -72,12 +72,12 @@ describe('pEp Get Ongoing Message Rating Feature', () => {
describe('Empty to', () => {
let result = "initial value";
before(() => {
q.respondWith({"jsonrpc":"2.0","id":3,"result":{"outParams":[{"rating":3}],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
queue.respondWith({"jsonrpc":"2.0","id":3,"result":{"outParams":[{"rating":3}],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
result = pEpController.getOngoingRating("cfg@pep.security", [{address: "", username: "test"}]);
});
it('should return a Object', () => {
q.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"outgoing_message_rating","params":[{"id":"pEp-0","shortmsg":"test","longmsg":"test","from":{"user_id":"","username":"anonymous","address":"cfg@pep.security"},"to":[{"user_id":"","username":"anonymous","address":"cfg@pep.security"}],"dir":1,"enc_format":3,"attachments":[],"opt_fields":[]},"0"],"id":1,"jsonrpc":"2.0"});
queue.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"outgoing_message_rating","params":[{"id":"pEp-0","shortmsg":"test","longmsg":"test","from":{"user_id":"","username":"anonymous","address":"cfg@pep.security"},"to":[{"user_id":"","username":"anonymous","address":"cfg@pep.security"}],"dir":1,"enc_format":3,"attachments":[],"opt_fields":[]},"0"],"id":1,"jsonrpc":"2.0"});
return result.should.become(0);
});
});
@ -85,12 +85,12 @@ describe('pEp Get Ongoing Message Rating Feature', () => {
describe('With 2 receviers', () => {
let result = "initial value";
before(() => {
q.respondWith({"jsonrpc":"2.0","id":3,"result":{"outParams":[{"rating":3}],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
queue.respondWith({"jsonrpc":"2.0","id":3,"result":{"outParams":[{"rating":3}],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
result = pEpController.getOngoingRating("cfg@pep.security", ["cfg@pep.security", "hk@pep.security"]);
});
it('should return a Object', () => {
q.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"outgoing_message_rating","params":[{"id":"pEp-0","shortmsg":"test","longmsg":"test","from":{"user_id":"","username":"anonymous","address":"cfg@pep.security"},"to":[{"user_id":"","username":"anonymous","address":"cfg@pep.security"}],"dir":1,"enc_format":3,"attachments":[],"opt_fields":[]},"0"],"id":1,"jsonrpc":"2.0"});
queue.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"outgoing_message_rating","params":[{"id":"pEp-0","shortmsg":"test","longmsg":"test","from":{"user_id":"","username":"anonymous","address":"cfg@pep.security"},"to":[{"user_id":"","username":"anonymous","address":"cfg@pep.security"}],"dir":1,"enc_format":3,"attachments":[],"opt_fields":[]},"0"],"id":1,"jsonrpc":"2.0"});
return result.should.become(3);
});
});
@ -98,12 +98,12 @@ describe('pEp Get Ongoing Message Rating Feature', () => {
describe('With none receviers', () => {
let result = "initial value";
before(() => {
q.respondWith({"jsonrpc":"2.0","id":3,"result":{"outParams":[{"rating":3}],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
queue.respondWith({"jsonrpc":"2.0","id":3,"result":{"outParams":[{"rating":3}],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
result = pEpController.getOngoingRating("cfg@pep.security", []);
});
it('should return a Object', () => {
q.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"outgoing_message_rating","params":[{"id":"pEp-0","shortmsg":"test","longmsg":"test","from":{"user_id":"","username":"anonymous","address":"cfg@pep.security"},"to":[{"user_id":"","username":"anonymous","address":"cfg@pep.security"}],"dir":1,"enc_format":3,"attachments":[],"opt_fields":[]},"0"],"id":1,"jsonrpc":"2.0"});
queue.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"outgoing_message_rating","params":[{"id":"pEp-0","shortmsg":"test","longmsg":"test","from":{"user_id":"","username":"anonymous","address":"cfg@pep.security"},"to":[{"user_id":"","username":"anonymous","address":"cfg@pep.security"}],"dir":1,"enc_format":3,"attachments":[],"opt_fields":[]},"0"],"id":1,"jsonrpc":"2.0"});
return result.should.become(0);
});
});
@ -112,12 +112,12 @@ describe('pEp Get Ongoing Message Rating Feature', () => {
describe('With none receviers', () => {
let result = "initial value";
before(() => {
q.respondWith({"jsonrpc":"2.0","id":3,"result":{"outParams":[{"rating":3}],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
queue.respondWith({"jsonrpc":"2.0","id":3,"result":{"outParams":[{"rating":3}],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
result = pEpController.getOngoingRating("cfg@pep.security", ["randomguy@randomdomain.com"]);
});
it('should return a Object', () => {
q.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"outgoing_message_rating","params":[{"id":"pEp-0","shortmsg":"test","longmsg":"test","from":{"user_id":"","username":"anonymous","address":"cfg@pep.security"},"to":[{"user_id":"","username":"anonymous","address":"cfg@pep.security"}],"dir":1,"enc_format":3,"attachments":[],"opt_fields":[]},"0"],"id":1,"jsonrpc":"2.0"});
queue.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"outgoing_message_rating","params":[{"id":"pEp-0","shortmsg":"test","longmsg":"test","from":{"user_id":"","username":"anonymous","address":"cfg@pep.security"},"to":[{"user_id":"","username":"anonymous","address":"cfg@pep.security"}],"dir":1,"enc_format":3,"attachments":[],"opt_fields":[]},"0"],"id":1,"jsonrpc":"2.0"});
return result.should.become(3);
});
});


+ 7
- 7
tests/features/get_trustwords_feature_spec.js View File

@ -3,17 +3,17 @@ let {describe, it, before, beforeEach} = require('mocha');
let chai = require('chai').use(require('chai-as-promised'));
chai.should();
let getController = require('../boilerplate').getController;
let getQ = require('../mock').getQ;
let getQueue = require('../mock').getQueue;
describe('pEp Get Trustwords Feature', () => {
let pEpController, q;
let pEpController, queue;
before(() => {
q = getQ();
pEpController = getController(q);
queue = getQueue();
pEpController = getController(queue);
});
after(() => {
q.after();
queue.after();
pEpController.after();
});
@ -36,12 +36,12 @@ describe('pEp Get Trustwords Feature', () => {
};
before(() => {
q.respondWith({"jsonrpc":"2.0","id":1,"result":{"outParams":[41,"CRYSTAL ELOPER ACCEPTABLY COHAN CLANKING "],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
queue.respondWith({"jsonrpc":"2.0","id":1,"result":{"outParams":[41,"CRYSTAL ELOPER ACCEPTABLY COHAN CLANKING "],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
result = pEpController.get_trustwords(identity1, identity2, lang);
});
it('should return a Array', () => {
q.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"get_trustwords","params":[{"user_id":"","username":"Test User 01","address":"test@test.com","fpr":"4ABE3AAF59AC32CFE4F86500A9411D176FF00E97"},{"user_id":"","username":"Test User 02","address":"test2@test.com","fpr":"B39706EF952EC3AF0BA5921A91F792D28B044A71"},"en","OUT","OUT",false],"id":1,"jsonrpc":"2.0"});
queue.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"get_trustwords","params":[{"user_id":"","username":"Test User 01","address":"test@test.com","fpr":"4ABE3AAF59AC32CFE4F86500A9411D176FF00E97"},{"user_id":"","username":"Test User 02","address":"test2@test.com","fpr":"B39706EF952EC3AF0BA5921A91F792D28B044A71"},"en","OUT","OUT",false],"id":1,"jsonrpc":"2.0"});
return result.should.become("CRYSTAL ELOPER ACCEPTABLY COHAN CLANKING ");
});
});


+ 7
- 7
tests/features/get_version_feature_spec.js View File

@ -6,14 +6,14 @@ chai.should();
describe('pEp Get Version Feature', () => {
let getController = require('../boilerplate').getController;
let getQ = require('../mock').getQ;
let q, pEpController;
let getQueue = require('../mock').getQueue;
let queue, pEpController;
before(() => {
q = getQ();
pEpController = getController(q);
queue = getQueue();
pEpController = getController(queue);
});
after(() => {
q.after();
queue.after();
pEpController.after();
});
@ -21,12 +21,12 @@ describe('pEp Get Version Feature', () => {
let adapter;
let result = "initial value";
before(() => {
q.respondWith({"jsonrpc":"2.0","id":1,"result":{"outParams":[],"return":{"major":0,"minor":17,"patch":0,"api_version":"0.17.0","name":"(40) Eisenach-Ost","package_version":[null],"engine_version":"1.1.1","pep_protocol_version":"2.1"},"errorstack":["(1 elements cleared)"]}});
queue.respondWith({"jsonrpc":"2.0","id":1,"result":{"outParams":[],"return":{"major":0,"minor":17,"patch":0,"api_version":"0.17.0","name":"(40) Eisenach-Ost","package_version":[null],"engine_version":"1.1.1","pep_protocol_version":"2.1"},"errorstack":["(1 elements cleared)"]}});
result = pEpController.getVersion();
});
it('should return a Object', () => {
q.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"serverVersion","params":[],"id":1,"jsonrpc":"2.0"});
queue.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"serverVersion","params":[],"id":1,"jsonrpc":"2.0"});
return result.should.become({
"api_version": "0.17.0",
"engine_version": "1.1.1",


+ 7
- 7
tests/features/identity_rating_feature_spec.js View File

@ -7,14 +7,14 @@ let pEp = require('../../chrome/content/modules/pEp');
describe('pEp Identity Rating Feature', () => {
let getController = require('../boilerplate').getController;
let getQ = require('../mock').getQ;
let q, pEpController;
let getQueue = require('../mock').getQueue;
let queue, pEpController;
before(() => {
q = getQ();
pEpController = getController(q);
queue = getQueue();
pEpController = getController(queue);
});
after(() => {
q.after();
queue.after();
pEpController.after();
});
@ -29,12 +29,12 @@ describe('pEp Identity Rating Feature', () => {
let identity = new pEp.Identity(testMail, testId, testName, testFp);
identity.rating = 6;
before(() => {
q.respondWith({"jsonrpc":"2.0","id":1,"result":{"outParams":[{"rating":6}],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
queue.respondWith({"jsonrpc":"2.0","id":1,"result":{"outParams":[{"rating":6}],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
result = pEpController.identity_rating(testMail, testId, testName, testFp);
});
it('should return a Object', () => {
q.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"identity_rating","params":[{"user_id":"test_user_id","username":"Test User 01","address":"test@test.com","fpr":""},["OP"]],"id":1,"jsonrpc":"2.0"});
queue.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"identity_rating","params":[{"user_id":"test_user_id","username":"Test User 01","address":"test@test.com","fpr":""},["OP"]],"id":1,"jsonrpc":"2.0"});
return result.should.become(identity);
});
});


+ 9
- 9
tests/features/is_pEp_user_feature_spec.js View File

@ -7,14 +7,14 @@ let pEp = require('../../chrome/content/modules/pEp');
describe('pEp Is pEp User Feature', () => {
let getController = require('../boilerplate').getController;
let getQ = require('../mock').getQ;
let q, pEpController;
let getQueue = require('../mock').getQueue;
let queue, pEpController;
before(() => {
q = getQ();
pEpController = getController(q);
queue = getQueue();
pEpController = getController(queue);
});
after(() => {
q.after();
queue.after();
pEpController.after();
});
@ -27,12 +27,12 @@ describe('pEp Is pEp User Feature', () => {
let testId = "test_user_id";
before(() => {
q.respondWith({"jsonrpc":"2.0","id":2,"result":{"outParams":[false],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
queue.respondWith({"jsonrpc":"2.0","id":2,"result":{"outParams":[false],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
result = pEpController.is_pEp_user(testMail, testId, testName, testFp);
});
it('should return a Object', () => {
q.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"is_pEp_user","params":[{"user_id":"test_user_id","username":"Test User 01","address":"test@test.com","fpr":""},true],"id":1,"jsonrpc":"2.0"});
queue.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"is_pEp_user","params":[{"user_id":"test_user_id","username":"Test User 01","address":"test@test.com","fpr":""},true],"id":1,"jsonrpc":"2.0"});
return result.should.eventually.have.property('is_pEp', false);
});
});
@ -48,12 +48,12 @@ describe('pEp Is pEp User Feature', () => {
let identity = new pEp.Identity(testMail, testId, testName, testFp);
identity.is_pEp = true;
before(() => {
q.respondWith({"jsonrpc":"2.0","id":2,"result":{"outParams":[true],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
queue.respondWith({"jsonrpc":"2.0","id":2,"result":{"outParams":[true],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
result = pEpController.is_pEp_user(testMail, testId, testName, testFp);
});
it('should return a Object', () => {
q.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"is_pEp_user","params":[{"user_id":"test_user_id","username":"Test User 01","address":"test@test.com","fpr":""},true],"id":1,"jsonrpc":"2.0"});
queue.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"is_pEp_user","params":[{"user_id":"test_user_id","username":"Test User 01","address":"test@test.com","fpr":""},true],"id":1,"jsonrpc":"2.0"});
return result.should.become(identity);
});
});


+ 7
- 7
tests/features/key_mistrusted_feature_spec.js View File

@ -6,14 +6,14 @@ chai.should();
describe('pEp Key Mistrusted Feature', () => {
let getController = require('../boilerplate').getController;
let getQ = require('../mock').getQ;
let q, pEpController;
let getQueue = require('../mock').getQueue;
let queue, pEpController;
before(() => {
q = getQ();
pEpController = getController(q);
queue = getQueue();
pEpController = getController(queue);
});
after(() => {
q.after();
queue.after();
pEpController.after();
});
@ -26,7 +26,7 @@ describe('pEp Key Mistrusted Feature', () => {
let testId = "test_user_id";
before(() => {
q.respondWith({
queue.respondWith({
"jsonrpc":"2.0",
"id":1,
"result":{
@ -42,7 +42,7 @@ describe('pEp Key Mistrusted Feature', () => {
});
it('should return a Object', () => {
q.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"key_mistrusted","params":[{"user_id":"test_user_id","username":"Test User 01","address":"test@test.com","fpr":"B39706EF952EC3AF0BA5921A91F792D28B044A71"}],"id":1,"jsonrpc":"2.0"});
queue.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"key_mistrusted","params":[{"user_id":"test_user_id","username":"Test User 01","address":"test@test.com","fpr":"B39706EF952EC3AF0BA5921A91F792D28B044A71"}],"id":1,"jsonrpc":"2.0"});
return result.should.become([]);
});
});


+ 7
- 7
tests/features/key_reset_trust_feature_spec.js View File

@ -6,14 +6,14 @@ chai.should();
describe('pEp Key Reset Trust Feature', () => {
let getController = require('../boilerplate').getController;
let getQ = require('../mock').getQ;
let q, pEpController;
let getQueue = require('../mock').getQueue;
let queue, pEpController;
before(() => {
q = getQ();
pEpController = getController(q);
queue = getQueue();
pEpController = getController(queue);
});
after(() => {
q.after();
queue.after();
pEpController.after();
});
@ -26,7 +26,7 @@ describe('pEp Key Reset Trust Feature', () => {
let testId = "test_user_id";
before(() => {
q.respondWith({
queue.respondWith({
"jsonrpc":"2.0",
"id":1,
"result":{
@ -42,7 +42,7 @@ describe('pEp Key Reset Trust Feature', () => {
});
it('should return a Object', () => {
q.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"key_reset_trust","params":[{"user_id":"test_user_id","username":"Test User 01","address":"test@test.com","fpr":"B39706EF952EC3AF0BA5921A91F792D28B044A71"}],"id":1,"jsonrpc":"2.0"});
queue.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"key_reset_trust","params":[{"user_id":"test_user_id","username":"Test User 01","address":"test@test.com","fpr":"B39706EF952EC3AF0BA5921A91F792D28B044A71"}],"id":1,"jsonrpc":"2.0"});
return result.should.become([]);
});
});


+ 9
- 9
tests/features/myself_feature_spec.js View File

@ -6,14 +6,14 @@ chai.should();
describe('pEp Myself Feature', () => {
let getController = require('../boilerplate').getController;
let getQ = require('../mock').getQ;
let q, pEpController;
let getQueue = require('../mock').getQueue;
let queue, pEpController;
before(() => {
q = getQ();
pEpController = getController(q);
queue = getQueue();
pEpController = getController(queue);
});
after(() => {
q.after();
queue.after();
pEpController.after();
});
@ -25,12 +25,12 @@ describe('pEp Myself Feature', () => {
let testFp = "";
before(() => {
q.respondWith({"jsonrpc":"2.0","id":2,"result":{"outParams":[{"address":"test@test.com","fpr":"1737B1324BC4997FCD24D997E9E71570C8644E1C","user_id":"pEp_own_userId","username":"Test User 01","comm_type":255}],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
queue.respondWith({"jsonrpc":"2.0","id":2,"result":{"outParams":[{"address":"test@test.com","fpr":"1737B1324BC4997FCD24D997E9E71570C8644E1C","user_id":"pEp_own_userId","username":"Test User 01","comm_type":255}],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
result = pEpController.myself(testMail, "pEp_own_userId", testName, testFp);
});
it('should return a Object', () => {
q.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"myself","params":[{"user_id":"pEp_own_userId","username":"Test User 01","address":"test@test.com","fpr":""}],"id":1,"jsonrpc":"2.0"});
queue.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"myself","params":[{"user_id":"pEp_own_userId","username":"Test User 01","address":"test@test.com","fpr":""}],"id":1,"jsonrpc":"2.0"});
return result.should.become({
"address": testMail,
"comm_type": 255,
@ -49,12 +49,12 @@ describe('pEp Myself Feature', () => {
let testFp = "";
before(() => {
q.respondWith({"jsonrpc":"2.0","id":2,"result":{"outParams":[{"address":"test@test.com","fpr":"1737B1324BC4997FCD24D997E9E71570C8644E1C","user_id":"pEp_own_userId","username":"Test User 01","comm_type":255}],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
queue.respondWith({"jsonrpc":"2.0","id":2,"result":{"outParams":[{"address":"test@test.com","fpr":"1737B1324BC4997FCD24D997E9E71570C8644E1C","user_id":"pEp_own_userId","username":"Test User 01","comm_type":255}],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
result = pEpController.myself(testMail, "pEp_own_userId", testName, testFp);
});
it('should return a Object', () => {
q.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"myself","params":[{"user_id":"pEp_own_userId","username":"Test User 01","address":"test@test.com","fpr":""}],"id":1,"jsonrpc":"2.0"});
queue.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"myself","params":[{"user_id":"pEp_own_userId","username":"Test User 01","address":"test@test.com","fpr":""}],"id":1,"jsonrpc":"2.0"});
return result.should.become({
"address": testMail,
"comm_type": 255,


+ 7
- 7
tests/features/trust_personal_key_feature_spec.js View File

@ -6,14 +6,14 @@ chai.should();
describe('pEp Trust Personal Key Feature', () => {
let getController = require('../boilerplate').getController;
let getQ = require('../mock').getQ;
let q, pEpController;
let getQueue = require('../mock').getQueue;
let queue, pEpController;
before(() => {
q = getQ();
pEpController = getController(q);
queue = getQueue();
pEpController = getController(queue);
});
after(() => {
q.after();
queue.after();
pEpController.after();
});
@ -26,12 +26,12 @@ describe('pEp Trust Personal Key Feature', () => {
let testId = "test_user_id";
before(() => {
q.respondWith({"jsonrpc":"2.0","id":1,"result":{"outParams":[],"return":{"status":518,"hex":"0x206 \"PEP_KEY_UNSUITABLE\""},"errorstack":["(1 elements cleared)"]}});
queue.respondWith({"jsonrpc":"2.0","id":1,"result":{"outParams":[],"return":{"status":518,"hex":"0x206 \"PEP_KEY_UNSUITABLE\""},"errorstack":["(1 elements cleared)"]}});
result = pEpController.trust_personal_key(testMail, testId, testName, testFp);
});
it('should return a Object', () => {
q.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"trust_personal_key","params":[{"user_id":"test_user_id","username":"Test User 01","address":"test@test.com","fpr":"B39706EF952EC3AF0BA5921A91F792D28B044A71"}],"id":1,"jsonrpc":"2.0"});
queue.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"trust_personal_key","params":[{"user_id":"test_user_id","username":"Test User 01","address":"test@test.com","fpr":"B39706EF952EC3AF0BA5921A91F792D28B044A71"}],"id":1,"jsonrpc":"2.0"});
return result.should.become([]);
});
});


+ 7
- 7
tests/features/update_identity_feature_spec.js View File

@ -6,14 +6,14 @@ chai.should();
describe('pEp Update Identity Feature', () => {
let getController = require('../boilerplate').getController;
let getQ = require('../mock').getQ;
let q, pEpController;
let getQueue = require('../mock').getQueue;
let queue, pEpController;
before(() => {
q = getQ();
pEpController = getController(q);
queue = getQueue();
pEpController = getController(queue);
});
after(() => {
q.after();
queue.after();
pEpController.after();
});
@ -26,12 +26,12 @@ describe('pEp Update Identity Feature', () => {
let testId = "test_user_id";
before(() => {
q.respondWith({"jsonrpc":"2.0","id":1,"result":{"outParams":[{"address":"test@test.com","fpr":"1737B1324BC4997FCD24D997E9E71570C8644E1C","user_id":"test_user_id","username":"Test User 01","comm_type":56}],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
queue.respondWith({"jsonrpc":"2.0","id":1,"result":{"outParams":[{"address":"test@test.com","fpr":"1737B1324BC4997FCD24D997E9E71570C8644E1C","user_id":"test_user_id","username":"Test User 01","comm_type":56}],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
result = pEpController.update_identity(testMail, testId, testName, testFp);
});
it('should return a Object', () => {
q.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"update_identity","params":[{"user_id":"test_user_id","username":"Test User 01","address":"test@test.com","fpr":""}],"id":1,"jsonrpc":"2.0"});
queue.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"update_identity","params":[{"user_id":"test_user_id","username":"Test User 01","address":"test@test.com","fpr":""}],"id":1,"jsonrpc":"2.0"});
return result.should.become({
"address": testMail,
"comm_type": 56,


+ 2
- 2
tests/legacy-features/decrypt_mime_feature_spec.js View File

@ -50,7 +50,7 @@ describe('Encrypt and then decrypt that message', () => {
});
it('should return a Object', () => {
return result.should.become("Message-ID: <pEp.PSKIS2.0HZWAQGGSUKQW.7ADF2614-81DE-47B1-9710-2DF90E5FC13E@pep.security>\r\nFrom: Chris <cfg@pep.security>\r\nTo: Chris <cfg@pep.security>\r\nSubject: \r\nX-pEp-Version: 2.0\r\nMIME-Version: 1.0\r\nContent-Type: text/plain; charset=\"utf-8\"\r\nContent-Transfer-Encoding: quoted-printable\r\nContent-Disposition: inline; filename=\"msg.txt\"\r\n\r\npEp-Wrapped-Message-Info: INNER\r\n\r\nTesting mime body message\r\n\r\n\r\n\r\n--b13a3164429599631f169025973e32\r\nContent-Type: application/pgp-keys\r\nContent-Disposition: attachment; filename=\"pEpkey.asc\"\r\n\r\n-----BEGIN PGP PUBLIC KEY BLOCK-----\r\n\r\nmQENBFt6xIIBCADCOVTvp1nMpdKJ6GYy5F4ajFMMMlXWkQlxoRTAy+amxHsEpT9n\r\nQbTRTcaEefdQifkP2c+2nquft2JAN0YeOE9oW9XueAtsWPoNtfzou++OS0qJx4I8\r\njcIj6gDgBl+XOrKMeDbublkcIvRhH6IJUV/HK1UTAl0FCkG4FbBh8NSRuxbjLT0v\r\na2v5DeRyj06z2GHJiEk0JJVdYNiOxUka4oG2mXk7iiRdTzXdYUEu48Q8LVTsVY1y\r\noWXYS8r7PFauybGqZzQNtR6ENJ0bSSvqufNDQRis98glNI8v4sr4yQnTMR35sUTV\r\njLwENWAkcuENhBdQfxEOPmUcdtYQVY+hoSjPABEBAAG0GENocmlzIDxjZmdAcGVw\r\nLnNlY3VyaXR5PokBVAQTAQgAPhYhBLJ3XXuRnJ4o7BubSSwOjeWV5KWUBQJbesSE\r\nAhsDBQkB4TOABQsJCAcCBhUKCQgLAgQWAgMBAh4BAheAAAoJECwOjeWV5KWUQQMH\r\n/j8VNwIQ9sm98vtWrXGqH8ARbBsp+tIXu6QggNsCAkk+7qWMgWM7oeEZ6SRIRHGQ\r\n/gk6whLH+fvJQKVkZIa7mn1reH1XXLO5L9sLQT5EWK3X3BxwdGtO3i0M3zBLuYXT\r\nZ7TZF/ot2feaQiRAUItKSgqU6Sobq4LnAvPInrM+MWqglYco2la/PlUcBUaI/gp7\r\nPkLMpwJBLPd3l+bViqss4hfi5cvHhNkswiFs6xNsoadlXLlwdWbDcHeWri8Uh4mC\r\nAKhSu3Xrhy+js8ReRYBiqp+JPignTOx4HQM1ekjBeum15AlYxnhAgl6aZ2WtMBII\r\nU4vZqqWtP04HLoo9VBH9udy5AQ0EW3rEgwEIAOqNuUmrz/4lWhIuPRx/EC+yxnMu\r\nnqepXkER8u7k5795lM6H8sLfGuF3fVrYvW4bbavXcibJGKO2c3rd4jp9usOfK/VX\r\nMxpPM5IxZUL7VA9zEcjf+FO8EMRAoYUYSxFxFWN1PPoYDYyXEKf8TbPcqPwzw6/Q\r\nYlhppBnIPXeZWf7WHhL4OMqNcpg8EuwwxhqxYCadLkbVRt8hXK+dHdQK7hLN4ftb\r\n1EmuRsbzLRD6VNcCBKSwm+sJ8vNE11xiEOPZLxd468hum1hVfeknDijGX16IivUV\r\nVkoHkGkR00qXV2ijQChFH4/Zu6eyivCSq3ME/s2LQa4XsEdbIp9VFaFS+qkAEQEA\r\nAYkBPAQYAQgAJhYhBLJ3XXuRnJ4o7BubSSwOjeWV5KWUBQJbesSDAhsMBQkB4TOA\r\nAAoJECwOjeWV5KWUAWoIAKo1VuCKGhT8J0zI+mNpT8Xx4yy/Nl2athSGw5rktsmF\r\ncEEwnWy2sYvkqpbbBxC1VOqzKQ/+/VL7ArPODkrFDpbZZ2qt5xC7ugT8wQRDhNx5\r\nesPZrty6vrfwt95PBWuJ+cQPts94D6qCpl4gl+wcg/fVMULIaN8plKXeeuUy80Yd\r\nZJMCenurL5JTz/bRETaIAUYbmJ3JNoJgJzqxMP1z2GyOB/pXouzSavPimdLxNmtK\r\niL3FFJqX3San2mu0+kUzGiO0gN0nrAPSObbJkZlhZIxAPWS6DyDlKKOoVppswFqR\r\nblHVpYLS0gr9k2it10aw+o2kUaM52QfrAEc1hTtf6AU=\r\n=Zj4H\r\n-----END PGP PUBLIC KEY BLOCK-----\r\n\r\n--b13a3164429599631f169025973e32--\r\n");
return result.should.become("Message-ID: <pEp.PSKIS2.0HZWAQGGSUKQW.7ADF2614-81DE-47B1-9710-2DF90E5FC13E@pep.security>\r\nFrom: Chris <cfg@pep.security>\r\nTo: Chris <cfg@pep.security>\r\nSubject: \r\nX-pEp-Version: 2.0\r\nMIME-Version: 1.0\r\nContent-Type: text/plain; charset=\"utf-8\"\r\nContent-Transfer-Encoding: quoted-printable\r\nContent-Disposition: inline; filename=\"msg.txt\"\r\n\r\npEp-Wrapped-Message-Info: INNER\r\n\r\nTesting mime body message\r\n\r\n\r\n\r\n--b13a3164429599631f169025973e32\r\nContent-Type: application/pgp-keys\r\nContent-Disposition: attachment; filename=\"pEpkey.asc\"\r\n\r\n-----BEGIN PGP PUBLIC KEY BLOCK-----\r\n\r\nmQENBFt6xIIBCADCOVTvp1nMpdKJ6GYy5F4ajFMMMlXWkQlxoRTAy+amxHsEpT9n\r\nQbTRTcaEefdQifkP2c+2nquft2JAN0YeOE9oW9XueAtsWPoNtfzou++OS0qJx4I8\r\njcIj6gDgBl+XOrKMeDbublkcIvRhH6IJUV/HK1UTAl0FCkG4FbBh8NSRuxbjLT0v\r\na2v5DeRyj06z2GHJiEk0JJVdYNiOxUka4oG2mXk7iiRdTzXdYUEu48Q8LVTsVY1y\r\noWXYS8r7PFauybGqZzQNtR6ENJ0bSSvqufNDQRis98glNI8v4sr4yQnTMR35sUTV\r\njLwENWAkcuENhBdQfxEOPmUcdtYQVY+hoSjPABEBAAG0GENocmlzIDxjZmdAcGVw\r\nLnNlY3VyaXR5PokBVAQTAQgAPhYhBLJ3XXuRnJ4o7BubSSwOjeWV5KWUBQJbesSE\r\nAhsDBQkB4TOABQsJCAcCBhUKCQgLAgQWAgMBAh4BAheAAAoJECwOjeWV5KWUQQMH\r\n/j8VNwIQ9sm98vtWrXGqH8ARbBsp+tIXu6QggNsCAkk+7qWMgWM7oeEZ6SRIRHGQ\r\n/gk6whLH+fvJQKVkZIa7mn1reH1XXLO5L9sLQT5EWK3X3BxwdGtO3i0M3zBLuYXT\r\nZ7TZF/ot2feaQiRAUItKSgqU6Sobq4LnAvPInrM+MWqglYco2la/PlUcBUaI/gp7\r\nPkLMpwJBLPd3l+bViqss4hfi5cvHhNkswiFs6xNsoadlXLlwdWbDcHeWri8Uh4mC\r\nAKhSu3Xrhy+js8ReRYBiqp+JPignTOx4HQM1ekjBeum15AlYxnhAgl6aZ2WtMBII\r\nU4vZqqWtP04HLoo9VBH9udy5AQ0EW3rEgwEIAOqNuUmrz/4lWhIuPRx/EC+yxnMu\r\nnqepXkER8u7k5795lM6H8sLfGuF3fVrYvW4bbavXcibJGKO2c3rd4jp9usOfK/VX\r\nMxpPM5IxZUL7VA9zEcjf+FO8EMRAoYUYSxFxFWN1PPoYDYyXEKf8TbPcqPwzw6/QUEUE\r\nYlhppBnIPXeZWf7WHhL4OMqNcpg8EuwwxhqxYCadLkbVRt8hXK+dHdQK7hLN4ftb\r\n1EmuRsbzLRD6VNcCBKSwm+sJ8vNE11xiEOPZLxd468hum1hVfeknDijGX16IivUV\r\nVkoHkGkR00qXV2ijQChFH4/Zu6eyivCSq3ME/s2LQa4XsEdbIp9VFaFS+qkAEQEA\r\nAYkBPAQYAQgAJhYhBLJ3XXuRnJ4o7BubSSwOjeWV5KWUBQJbesSDAhsMBQkB4TOA\r\nAAoJECwOjeWV5KWUAWoIAKo1VuCKGhT8J0zI+mNpT8Xx4yy/Nl2athSGw5rktsmF\r\ncEEwnWy2sYvkqpbbBxC1VOqzKQ/+/VL7ArPODkrFDpbZZ2qt5xC7ugT8wQRDhNx5\r\nesPZrty6vrfwt95PBWuJ+cQPts94D6qCpl4gl+wcg/fVMULIaN8plKXeeuUy80Yd\r\nZJMCenurL5JTz/bRETaIAUYbmJ3JNoJgJzqxMP1z2GyOB/pXouzSavPimdLxNmtK\r\niL3FFJqX3San2mu0+kUzGiO0gN0nrAPSObbJkZlhZIxAPWS6DyDlKKOoVppswFqR\r\nblHVpYLS0gr9k2it10aw+o2kUaM52QfrAEc1hTtf6AU=\r\n=Zj4H\r\n-----END PGP PUBLIC KEY BLOCK-----\r\n\r\n--b13a3164429599631f169025973e32--\r\n");
});
});
});
});

+ 3
- 3
tests/legacy-features/get_mime_decode_message_feature.js View File

@ -39,13 +39,13 @@ describe('pEp Get MIME Decode Message Feature', () => {
describe('Perfect scenario', () => {
let result = "initial value";
before(() => {
let mimeMessage = "Content-Type: multipart/mixed; boundary=\"6eScLyM0zSVAO5IxFInNBQ0ryI41LEvV8\"; protected-headers=\"v1\" From: =?UTF-8?Q?J=c3=b6rg_Knobloch?= To: Chris Message-ID: Subject: =?UTF-8?B?UmU6IEVuaWdtYWlsL3DiiaFw?= References: <63594d7b-4fb6-9fac-e9c7-2c33024d315c@jorgk.com> In-Reply-To: --6eScLyM0zSVAO5IxFInNBQ0ryI41LEvV8 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Content-Language: en-GB On 19/03/2019 11:24, Chris wrote: > If I can keep contacting you through mail or > IRC it's ok;-) > > Are you moving there? You'll miss the best weather time! Hi, of course you can contact me any time! We have two apartments, one in Berlin and one in Sant Pol de Mar. I try=20 to spend as much time as I can in Catalonia (English spelling), but I=20 have many obligations in Berlin. I'll be back in July, hopefully earlier.= Take care, J=C3=B6rg. --6eScLyM0zSVAO5IxFInNBQ0ryI41LEvV8-- ";
let mimeMessage = "Content-Type: multipart/mixed; boundary=\"6eScLyM0zSVAO5IxFInNBQ0ryI41LEvV8\"; protected-headers=\"v1\" From: =?UTF-8?QUEUE?J=c3=b6rg_Knobloch?= To: Chris Message-ID: Subject: =?UTF-8?B?UmU6IEVuaWdtYWlsL3DiiaFw?= References: <63594d7b-4fb6-9fac-e9c7-2c33024d315c@jorgk.com> In-Reply-To: --6eScLyM0zSVAO5IxFInNBQ0ryI41LEvV8 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Content-Language: en-GB On 19/03/2019 11:24, Chris wrote: > If I can keep contacting you through mail or > IRC it's ok;-) > > Are you moving there? You'll miss the best weather time! Hi, of course you can contact me any time! We have two apartments, one in Berlin and one in Sant Pol de Mar. I try=20 to spend as much time as I can in Catalonia (English spelling), but I=20 have many obligations in Berlin. I'll be back in July, hopefully earlier.= Take care, J=C3=B6rg. --6eScLyM0zSVAO5IxFInNBQ0ryI41LEvV8-- ";
result = pEpController.messageFromMIME(mimeMessage);
});
it('should return a Object', () => {
return result.should.become({
"longmsg": "Content-Type: multipart/mixed; boundary=\"6eScLyM0zSVAO5IxFInNBQ0ryI41LEvV8\"; protected-headers=\"v1\" From: =?UTF-8?Q?J=c3=b6rg_Knobloch?= To: Chris Message-ID: Subject: =?UTF-8?B?UmU6IEVuaWdtYWlsL3DiiaFw?= References: <63594d7b-4fb6-9fac-e9c7-2c33024d315c@jorgk.com> In-Reply-To: --6eScLyM0zSVAO5IxFInNBQ0ryI41LEvV8 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Content-Language: en-GB On 19/03/2019 11:24, Chris wrote: > If I can keep contacting you through mail or > IRC it's ok;-) > > Are you moving there? You'll miss the best weather time! Hi, of course you can contact me any time! We have two apartments, one in Berlin and one in Sant Pol de Mar. I try=20 to spend as much time as I can in Catalonia (English spelling), but I=20 have many obligations in Berlin. I'll be back in July, hopefully earlier.= Take care, J=C3=B6rg. --6eScLyM0zSVAO5IxFInNBQ0ryI41LEvV8-- "
"longmsg": "Content-Type: multipart/mixed; boundary=\"6eScLyM0zSVAO5IxFInNBQ0ryI41LEvV8\"; protected-headers=\"v1\" From: =?UTF-8?QUEUE?J=c3=b6rg_Knobloch?= To: Chris Message-ID: Subject: =?UTF-8?B?UmU6IEVuaWdtYWlsL3DiiaFw?= References: <63594d7b-4fb6-9fac-e9c7-2c33024d315c@jorgk.com> In-Reply-To: --6eScLyM0zSVAO5IxFInNBQ0ryI41LEvV8 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Content-Language: en-GB On 19/03/2019 11:24, Chris wrote: > If I can keep contacting you through mail or > IRC it's ok;-) > > Are you moving there? You'll miss the best weather time! Hi, of course you can contact me any time! We have two apartments, one in Berlin and one in Sant Pol de Mar. I try=20 to spend as much time as I can in Catalonia (English spelling), but I=20 have many obligations in Berlin. I'll be back in July, hopefully earlier.= Take care, J=C3=B6rg. --6eScLyM0zSVAO5IxFInNBQ0ryI41LEvV8-- "
});
});
});
@ -80,4 +80,4 @@ describe('pEp Get MIME Decode Message Feature', () => {
});
});
});
});
});

+ 9
- 9
tests/mock.js View File

@ -6,36 +6,36 @@ let expect = require('chai').expect
let sinon = require('sinon');
// unset to use the actual server
let mocked = true;
function getQ () {
function getQueue () {
let XhrQueue = require('../chrome/content/modules/xhrQueue');
let s = sinon.fakeServer.create();
s.respondImmediately = true;
let q = new XhrQueue(console.log);
let queue = new XhrQueue(console.log);
if (mocked) {
q.XMLHttpRequest = s.xhr;
queue.XMLHttpRequest = s.xhr;
}
q.respondWith = (receive) => {
queue.respondWith = (receive) => {
s.respondWith([200, {}, JSON.stringify(receive)]);
};
q.respondWithSeries = (responses) => {
queue.respondWithSeries = (responses) => {
s.respondWith((response) => {
response.respond(200, {}, JSON.stringify(responses.shift()))
});
};
q.expectSent = (expected, z=0) => {
queue.expectSent = (expected, z=0) => {
if (mocked) {
let body = s.getRequest(z).requestBody;
expect(body).to.equal(JSON.stringify(expected));
}
};
q.after = () => {
queue.after = () => {
s.restore();
};
return q;
return queue;
}
module.exports = {
getQ
getQueue
}

+ 26
- 26
tests/unit/controller.js View File

@ -1,35 +1,35 @@
/* eslint-disable no-console */
let {describe, it, before, beforeEach} = require('mocha');
let chai = require('chai').use(require('chai-as-promised'));
let getQ = require('../mock').getQ;
let getQueue = require('../mock').getQueue;
let getController = require('../boilerplate').getController;
let expect = require('chai').expect
chai.should();
describe('controller calls', () => {
let result, q, controller;
let result, queue, controller;
let testMail = "test@test.com";
let testName = "Test User 01";
let testFp = "B39706EF952EC3AF0BA5921A91F792D28B044A71";
let testId = "test_user_id";
beforeEach(() => {
q = getQ();
controller = getController(q);
queue = getQueue();
controller = getController(queue);
});
afterEach(() => {
q.after();
queue.after();
controller.after();
});
it('get ongoing rating', () => {
q.respondWith({"jsonrpc":"2.0","id":3,"result":{"outParams":[{"rating":3}],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
queue.respondWith({"jsonrpc":"2.0","id":3,"result":{"outParams":[{"rating":3}],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
let result = controller.getOngoingRating("cfg@pep.security", ["cfg@pep.security", "hk@pep.security"]);
q.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"outgoing_message_rating","params":[{"id":"pEp-0","shortmsg":"test","longmsg":"test","from":{"user_id":"","username":"anonymous","address":"cfg@pep.security"},"to":[{"user_id":"","username":"anonymous","address":"cfg@pep.security"},{"user_id":"","username":"anonymous","address":"hk@pep.security"}],"dir":1,"enc_format":3,"attachments":[],"opt_fields":[]},"0"],"id":1,"jsonrpc":"2.0"});
queue.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"outgoing_message_rating","params":[{"id":"pEp-0","shortmsg":"test","longmsg":"test","from":{"user_id":"","username":"anonymous","address":"cfg@pep.security"},"to":[{"user_id":"","username":"anonymous","address":"cfg@pep.security"},{"user_id":"","username":"anonymous","address":"hk@pep.security"}],"dir":1,"enc_format":3,"attachments":[],"opt_fields":[]},"0"],"id":1,"jsonrpc":"2.0"});
return result.should.become(3);
});
it('myself', () => {
q.respondWith({"jsonrpc":"2.0","id":2,"result":{"outParams":[{"address":"test@test.com","fpr":"1737B1324BC4997FCD24D997E9E71570C8644E1C","user_id":"pEp_own_userId","username":"Test User 01","comm_type":255}],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
queue.respondWith({"jsonrpc":"2.0","id":2,"result":{"outParams":[{"address":"test@test.com","fpr":"1737B1324BC4997FCD24D997E9E71570C8644E1C","user_id":"pEp_own_userId","username":"Test User 01","comm_type":255}],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
let result = controller.myself(testMail, "pEp_own_userId", testName, testFp)
q.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"myself","params":[{"user_id":"pEp_own_userId","username":"Test User 01","address":"test@test.com","fpr":"B39706EF952EC3AF0BA5921A91F792D28B044A71"}],"id":1,"jsonrpc":"2.0"});
queue.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"myself","params":[{"user_id":"pEp_own_userId","username":"Test User 01","address":"test@test.com","fpr":"B39706EF952EC3AF0BA5921A91F792D28B044A71"}],"id":1,"jsonrpc":"2.0"});
return result.should.become({
"address": testMail,
"comm_type": 255,
@ -40,20 +40,20 @@ describe('controller calls', () => {
});
describe('is pEp user', () => {
it('true', () => {
q.respondWith({"jsonrpc":"2.0","id":2,"result":{"outParams":[true],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
queue.respondWith({"jsonrpc":"2.0","id":2,"result":{"outParams":[true],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
result = controller.is_pEp_user(testMail, testId, testName, testFp);
q.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"is_pEp_user","params":[{"user_id":"test_user_id","username":"Test User 01","address":"test@test.com","fpr":"B39706EF952EC3AF0BA5921A91F792D28B044A71"},true],"id":1,"jsonrpc":"2.0"});
queue.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"is_pEp_user","params":[{"user_id":"test_user_id","username":"Test User 01","address":"test@test.com","fpr":"B39706EF952EC3AF0BA5921A91F792D28B044A71"},true],"id":1,"jsonrpc":"2.0"});
return expect(result).to.eventually.have.property('is_pEp', true);
});
it('false', () => {
q.respondWith({"jsonrpc":"2.0","id":2,"result":{"outParams":[false],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
queue.respondWith({"jsonrpc":"2.0","id":2,"result":{"outParams":[false],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
result = controller.is_pEp_user(testMail, testId, testName, testFp);
q.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"is_pEp_user","params":[{"user_id":"test_user_id","username":"Test User 01","address":"test@test.com","fpr":"B39706EF952EC3AF0BA5921A91F792D28B044A71"},true],"id":1,"jsonrpc":"2.0"});
queue.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"is_pEp_user","params":[{"user_id":"test_user_id","username":"Test User 01","address":"test@test.com","fpr":"B39706EF952EC3AF0BA5921A91F792D28B044A71"},true],"id":1,"jsonrpc":"2.0"});
return expect(result).to.eventually.have.property('is_pEp', false);
});
});
it('get trustwords', () => {
q.respondWith({"jsonrpc":"2.0","id":1,"result":{"outParams":[41,"CRYSTAL ELOPER ACCEPTABLY COHAN CLANKING "],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
queue.respondWith({"jsonrpc":"2.0","id":1,"result":{"outParams":[41,"CRYSTAL ELOPER ACCEPTABLY COHAN CLANKING "],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
let lang = "en";
let identity1 = {
address: "test@test.com",
@ -68,13 +68,13 @@ describe('controller calls', () => {
user_id: ""
};
let result = controller.get_trustwords(identity1, identity2, lang)
q.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"get_trustwords","params":[{"user_id":"","username":"Test User 01","address":"test@test.com","fpr":"4ABE3AAF59AC32CFE4F86500A9411D176FF00E97"},{"user_id":"","username":"Test User 02","address":"test2@test.com","fpr":"B39706EF952EC3AF0BA5921A91F792D28B044A71"},"en","OUT","OUT",false],"id":1,"jsonrpc":"2.0"});
queue.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"get_trustwords","params":[{"user_id":"","username":"Test User 01","address":"test@test.com","fpr":"4ABE3AAF59AC32CFE4F86500A9411D176FF00E97"},{"user_id":"","username":"Test User 02","address":"test2@test.com","fpr":"B39706EF952EC3AF0BA5921A91F792D28B044A71"},"en","OUT","OUT",false],"id":1,"jsonrpc":"2.0"});
return result.should.become("CRYSTAL ELOPER ACCEPTABLY COHAN CLANKING ");
});
it('update identity', () => {
q.respondWith({"jsonrpc":"2.0","id":1,"result":{"outParams":[{"address":"test@test.com","fpr":"1737B1324BC4997FCD24D997E9E71570C8644E1C","user_id":"test_user_id","username":"Test User 01","comm_type":56}],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
queue.respondWith({"jsonrpc":"2.0","id":1,"result":{"outParams":[{"address":"test@test.com","fpr":"1737B1324BC4997FCD24D997E9E71570C8644E1C","user_id":"test_user_id","username":"Test User 01","comm_type":56}],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
let result = controller.update_identity(testMail, testId, testName, testFp)
q.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"update_identity","params":[{"user_id":"test_user_id","username":"Test User 01","address":"test@test.com","fpr":"B39706EF952EC3AF0BA5921A91F792D28B044A71"}],"id":1,"jsonrpc":"2.0"});
queue.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"update_identity","params":[{"user_id":"test_user_id","username":"Test User 01","address":"test@test.com","fpr":"B39706EF952EC3AF0BA5921A91F792D28B044A71"}],"id":1,"jsonrpc":"2.0"});
return result.should.become({
"address": testMail,
"comm_type": 56,
@ -84,9 +84,9 @@ describe('controller calls', () => {
});
});
it('get version', () => {
q.respondWith({"jsonrpc":"2.0","id":1,"result":{"outParams":[],"return":{"major":0,"minor":17,"patch":0,"api_version":"0.17.0","name":"(40) Eisenach-Ost","package_version":[null],"engine_version":"1.1.1","pep_protocol_version":"2.1"},"errorstack":["(1 elements cleared)"]}});
queue.respondWith({"jsonrpc":"2.0","id":1,"result":{"outParams":[],"return":{"major":0,"minor":17,"patch":0,"api_version":"0.17.0","name":"(40) Eisenach-Ost","package_version":[null],"engine_version":"1.1.1","pep_protocol_version":"2.1"},"errorstack":["(1 elements cleared)"]}});
let result = controller.getVersion();
q.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"serverVersion","params":[],"id":1,"jsonrpc":"2.0"});
queue.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"serverVersion","params":[],"id":1,"jsonrpc":"2.0"});
return result.should.become({
api_version: "0.17.0",
engine_version: "1.1.1",
@ -99,22 +99,22 @@ describe('controller calls', () => {
});
});
it('trust personal key', () => {
q.respondWith({"jsonrpc":"2.0","id":1,"result":{"outParams":[],"return":{"status":518,"hex":"0x206 \"PEP_KEY_UNSUITABLE\""},"errorstack":["(1 elements cleared)"]}});
queue.respondWith({"jsonrpc":"2.0","id":1,"result":{"outParams":[],"return":{"status":518,"hex":"0x206 \"PEP_KEY_UNSUITABLE\""},"errorstack":["(1 elements cleared)"]}});
result = controller.trust_personal_key(testMail, testId, testName, testFp);
q.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"trust_personal_key","params":[{"user_id":"test_user_id","username":"Test User 01","address":"test@test.com","fpr":"B39706EF952EC3AF0BA5921A91F792D28B044A71"}],"id":1,"jsonrpc":"2.0"});
queue.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"trust_personal_key","params":[{"user_id":"test_user_id","username":"Test User 01","address":"test@test.com","fpr":"B39706EF952EC3AF0BA5921A91F792D28B044A71"}],"id":1,"jsonrpc":"2.0"});
return result.should.become([]);
});
it('identity rating', () => {
q.respondWith({"jsonrpc":"2.0","id":1,"result":{"outParams":[{"rating":6}],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
queue.respondWith({"jsonrpc":"2.0","id":1,"result":{"outParams":[{"rating":6}],"return":{"status":0,"hex":"0 \"PEP_STATUS_OK\""},"errorstack":["(1 elements cleared)"]}});
result = controller.identity_rating(testMail, testId, testName, testFp);
q.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"identity_rating","params":[{"user_id":"test_user_id","username":"Test User 01","address":"test@test.com","fpr":"B39706EF952EC3AF0BA5921A91F792D28B044A71"},["OP"]],"id":1,"jsonrpc":"2.0"});
queue.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"identity_rating","params":[{"user_id":"test_user_id","username":"Test User 01","address":"test@test.com","fpr":"B39706EF952EC3AF0BA5921A91F792D28B044A71"},["OP"]],"id":1,"jsonrpc":"2.0"});
identity = new pEp.Identity(testMail, testId, testName, testFp);
identity.rating = 6;
return result.should.become(identity);
});
describe('with empty responses', () => {
beforeEach(() => {
q.respondWith({
queue.respondWith({
"jsonrpc":"2.0",
"id":1,
"result":{
@ -129,12 +129,12 @@ describe('controller calls', () => {
});
it('key mistrusted', () => {
result = controller.key_mistrusted(testMail, testId, testName, testFp);
q.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"key_mistrusted","params":[{"user_id":"test_user_id","username":"Test User 01","address":"test@test.com","fpr":"B39706EF952EC3AF0BA5921A91F792D28B044A71"}],"id":1,"jsonrpc":"2.0"});
queue.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"key_mistrusted","params":[{"user_id":"test_user_id","username":"Test User 01","address":"test@test.com","fpr":"B39706EF952EC3AF0BA5921A91F792D28B044A71"}],"id":1,"jsonrpc":"2.0"});
return result.should.become([]);
});
it('key reset trust', () => {
result = controller.key_reset_trust(testMail, testId, testName, testFp);
q.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"key_reset_trust","params":[{"user_id":"test_user_id","username":"Test User 01","address":"test@test.com","fpr":"B39706EF952EC3AF0BA5921A91F792D28B044A71"}],"id":1,"jsonrpc":"2.0"});
queue.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"key_reset_trust","params":[{"user_id":"test_user_id","username":"Test User 01","address":"test@test.com","fpr":"B39706EF952EC3AF0BA5921A91F792D28B044A71"}],"id":1,"jsonrpc":"2.0"});
return result.should.become([]);
});
});


Loading…
Cancel
Save