Browse Source

Fix myself()-related tests and one more with serverVersion(). 41 pass, 14 fail, sum: 55.

1.1.101
Jorg Knobloch 1 year ago
parent
commit
25c470a9f0
2 changed files with 17 additions and 16 deletions
  1. +11
    -11
      tests/features/myself_feature_spec.js
  2. +6
    -5
      tests/unit/controller.js

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

@ -22,19 +22,19 @@ describe('pEp Myself Feature', () => {
let testMail = "test@test.com";
let testName = "Test User 01";
let testFp = "";
before(() => {
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);
queue.respondWith({"jsonrpc":"2.0","id":2,"result":{"outParams":[{"address":"test@test.com","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({address: testMail, userid: "pEp_own_userId", username: testName});
});
it('should return a Object', () => {
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"});
queue.expectSent(
{"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"myself","params":[{"address":"test@test.com","userid":"pEp_own_userId","username":"Test User 01"}],"id":1,"jsonrpc":"2.0"}
);
return result.should.become({
"address": testMail,
"comm_type": 255,
"fpr": "1737B1324BC4997FCD24D997E9E71570C8644E1C",
"user_id": "pEp_own_userId",
"username": testName,
});
@ -46,21 +46,21 @@ describe('pEp Myself Feature', () => {
let testMail = "test@test.com";
let testName = "";
let testFp = "";
before(() => {
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);
queue.respondWith({"jsonrpc":"2.0","id":2,"result":{"outParams":[{"address":"test@test.com","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({address: testMail, userid: "pEp_own_userId", username: testName});
});
it('should return a Object', () => {
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"});
queue.expectSent(
{"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"myself","params":[{"address":"test@test.com","userid":"pEp_own_userId","username":"Test User 01"}],"id":1,"jsonrpc":"2.0"}
);
return result.should.become({
"address": testMail,
"comm_type": 255,
"fpr": "1737B1324BC4997FCD24D997E9E71570C8644E1C",
"user_id": "pEp_own_userId",
"username": "Test User 01", // previous test username TODO dont make it dependant
"username": "",
});
});
});


+ 6
- 5
tests/unit/controller.js View File

@ -39,13 +39,14 @@ describe('controller calls', () => {
return result.should.become(3);
});
it('myself', () => {
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)
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"});
queue.respondWith({"jsonrpc":"2.0","id":2,"result":{"outParams":[{"address":"test@test.com","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({address: testMail, userid: "pEp_own_userId", username: testName});
queue.expectSent(
{"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"myself","params":[{"address":"test@test.com","userid":"pEp_own_userId","username":"Test User 01"}],"id":1,"jsonrpc":"2.0"}
);
return result.should.become({
"address": testMail,
"comm_type": 255,
"fpr": "1737B1324BC4997FCD24D997E9E71570C8644E1C",
"user_id": "pEp_own_userId",
"username": testName,
});
@ -97,7 +98,7 @@ describe('controller calls', () => {
});
it('get version', () => {
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();
let result = controller.serverVersion();
queue.expectSent({"security_token":"0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW","method":"serverVersion","params":[],"id":1,"jsonrpc":"2.0"});
return result.should.become({
api_version: "0.17.0",


Loading…
Cancel
Save