Browse Source

Fix tests after changing parameters in commit f752b727.

master
Jörg Knobloch 1 year ago
parent
commit
686ecd0a67
8 changed files with 60 additions and 34 deletions
  1. +2
    -2
      tests/features/get_trustwords_feature_spec.js
  2. +2
    -2
      tests/features/identity_rating_feature_spec.js
  3. +8
    -4
      tests/features/is_pEp_user_feature_spec.js
  4. +4
    -2
      tests/features/key_mistrusted_feature_spec.js
  5. +4
    -2
      tests/features/key_reset_trust_feature_spec.js
  6. +4
    -2
      tests/features/trust_personal_key_feature_spec.js
  7. +4
    -2
      tests/features/update_identity_feature_spec.js
  8. +32
    -18
      tests/unit/controller.js

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

@ -48,9 +48,9 @@ describe("pEp Get Trustwords Feature", () => {
security_token: "0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW",
method: "get_trustwords",
params: [{
user_id: "", username: "Test User 01", address: "test@test.com", fpr: "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97",
address: "test@test.com", username: "Test User 01", fpr: "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", user_id: "",
}, {
user_id: "", username: "Test User 02", address: "test2@test.com", fpr: "B39706EF952EC3AF0BA5921A91F792D28B044A71",
address: "test2@test.com", username: "Test User 02", fpr: "B39706EF952EC3AF0BA5921A91F792D28B044A71", user_id: "",
}, "en", "OUT", "OUT", false],
id: 1,
jsonrpc: "2.0",


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

@ -32,7 +32,7 @@ describe("pEp Identity Rating Feature", () => {
identity.rating = 6;
before(() => {
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);
result = pEpController.identity_rating(identity);
});
it("should return a Object", () => {
@ -40,7 +40,7 @@ describe("pEp Identity Rating Feature", () => {
security_token: "0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW",
method: "identity_rating",
params: [{
user_id: "test_user_id", username: "Test User 01", address: "test@test.com", fpr: "",
user_id: "test_user_id", username: "Test User 01", address: "test@test.com", fpr: "", rating: 6,
}, ["OP"]],
id: 1,
jsonrpc: "2.0",


+ 8
- 4
tests/features/is_pEp_user_feature_spec.js View File

@ -30,7 +30,9 @@ describe("pEp Is pEp User Feature", () => {
before(() => {
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);
result = pEpController.is_pEp_user({
address: testMail, user_id: testId, username: testName, fpr: testFp,
});
});
it("should return a Object", () => {
@ -38,7 +40,7 @@ describe("pEp Is pEp User Feature", () => {
security_token: "0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW",
method: "is_pEp_user",
params: [{
user_id: "test_user_id", username: "Test User 01", address: "test@test.com", fpr: "",
address: "test@test.com", user_id: "test_user_id", username: "Test User 01", fpr: "",
}, true],
id: 1,
jsonrpc: "2.0",
@ -59,7 +61,9 @@ describe("pEp Is pEp User Feature", () => {
identity.is_pEp = true;
before(() => {
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);
result = pEpController.is_pEp_user({
address: testMail, user_id: testId, username: testName, fpr: testFp,
});
});
it("should return a Object", () => {
@ -67,7 +71,7 @@ describe("pEp Is pEp User Feature", () => {
security_token: "0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW",
method: "is_pEp_user",
params: [{
user_id: "test_user_id", username: "Test User 01", address: "test@test.com", fpr: "",
address: "test@test.com", user_id: "test_user_id", username: "Test User 01", fpr: "",
}, true],
id: 1,
jsonrpc: "2.0",


+ 4
- 2
tests/features/key_mistrusted_feature_spec.js View File

@ -40,7 +40,9 @@ describe("pEp Key Mistrusted Feature", () => {
errorstack: ["(1 elements cleared)"],
},
});
result = pEpController.key_mistrusted(testMail, testId, testName, testFp);
result = pEpController.key_mistrusted({
address: testMail, user_id: testId, username: testName, fpr: testFp,
});
});
it("should return a Object", () => {
@ -48,7 +50,7 @@ describe("pEp Key Mistrusted Feature", () => {
security_token: "0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW",
method: "key_mistrusted",
params: [{
user_id: "test_user_id", username: "Test User 01", address: "test@test.com", fpr: "B39706EF952EC3AF0BA5921A91F792D28B044A71",
address: "test@test.com", user_id: "test_user_id", username: "Test User 01", fpr: "B39706EF952EC3AF0BA5921A91F792D28B044A71",
}],
id: 1,
jsonrpc: "2.0",


+ 4
- 2
tests/features/key_reset_trust_feature_spec.js View File

@ -40,7 +40,9 @@ describe("pEp Key Reset Trust Feature", () => {
errorstack: ["(1 elements cleared)"],
},
});
result = pEpController.key_reset_trust(testMail, testId, testName, testFp);
result = pEpController.key_reset_trust({
address: testMail, user_id: testId, username: testName, fpr: testFp,
});
});
it("should return a Object", () => {
@ -48,7 +50,7 @@ describe("pEp Key Reset Trust Feature", () => {
security_token: "0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW",
method: "key_reset_trust",
params: [{
user_id: "test_user_id", username: "Test User 01", address: "test@test.com", fpr: "B39706EF952EC3AF0BA5921A91F792D28B044A71",
address: "test@test.com", user_id: "test_user_id", username: "Test User 01", fpr: "B39706EF952EC3AF0BA5921A91F792D28B044A71",
}],
id: 1,
jsonrpc: "2.0",


+ 4
- 2
tests/features/trust_personal_key_feature_spec.js View File

@ -29,7 +29,9 @@ describe("pEp Trust Personal Key Feature", () => {
before(() => {
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);
result = pEpController.trust_personal_key({
address: testMail, user_id: testId, username: testName, fpr: testFp,
});
});
it("should return a Object", () => {
@ -37,7 +39,7 @@ describe("pEp Trust Personal Key Feature", () => {
security_token: "0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW",
method: "trust_personal_key",
params: [{
user_id: "test_user_id", username: "Test User 01", address: "test@test.com", fpr: "B39706EF952EC3AF0BA5921A91F792D28B044A71",
address: "test@test.com", user_id: "test_user_id", username: "Test User 01", fpr: "B39706EF952EC3AF0BA5921A91F792D28B044A71",
}],
id: 1,
jsonrpc: "2.0",


+ 4
- 2
tests/features/update_identity_feature_spec.js View File

@ -39,7 +39,9 @@ describe("pEp Update Identity Feature", () => {
errorstack: ["(1 elements cleared)"],
},
});
result = pEpController.update_identity(testMail, testId, testName, testFp);
result = pEpController.update_identity({
address: testMail, user_id: testId, username: testName, fpr: testFp,
});
});
it("should return a Object", () => {
@ -47,7 +49,7 @@ describe("pEp Update Identity Feature", () => {
security_token: "0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW",
method: "update_identity",
params: [{
user_id: "test_user_id", username: "Test User 01", address: "test@test.com", fpr: "",
address: "test@test.com", user_id: "test_user_id", username: "Test User 01", fpr: "",
}],
id: 1,
jsonrpc: "2.0",


+ 32
- 18
tests/unit/controller.js View File

@ -80,10 +80,10 @@ describe("controller calls", () => {
errorstack: ["(1 elements cleared)"],
},
});
let result = controller.myself({ address: testMail, userid: "pEp_own_userId", username: testName });
let result = controller.myself({ address: testMail, user_id: "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",
security_token: "0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW", method: "myself", params: [{ address: "test@test.com", user_id: "pEp_own_userId", username: "Test User 01" }], id: 1, jsonrpc: "2.0",
},
);
return result.should.become({
@ -96,12 +96,14 @@ describe("controller calls", () => {
describe("is pEp user", () => {
it("true", () => {
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);
result = controller.is_pEp_user({
address: testMail, user_id: testId, username: testName, fpr: testFp,
});
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",
address: "test@test.com", user_id: "test_user_id", username: "Test User 01", fpr: "B39706EF952EC3AF0BA5921A91F792D28B044A71",
}, true],
id: 1,
jsonrpc: "2.0",
@ -110,12 +112,14 @@ describe("controller calls", () => {
});
it("false", () => {
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);
result = controller.is_pEp_user({
address: testMail, user_id: testId, username: testName, fpr: testFp,
});
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",
address: "test@test.com", user_id: "test_user_id", username: "Test User 01", fpr: "B39706EF952EC3AF0BA5921A91F792D28B044A71",
}, true],
id: 1,
jsonrpc: "2.0",
@ -143,9 +147,9 @@ describe("controller calls", () => {
security_token: "0847cqi9WqqE5ZcVtA8_mDIgEmYMv14xlNAvSZW",
method: "get_trustwords",
params: [{
user_id: "", username: "Test User 01", address: "test@test.com", fpr: "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97",
address: "test@test.com", username: "Test User 01", fpr: "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", user_id: "",
}, {
user_id: "", username: "Test User 02", address: "test2@test.com", fpr: "B39706EF952EC3AF0BA5921A91F792D28B044A71",
address: "test2@test.com", username: "Test User 02", fpr: "B39706EF952EC3AF0BA5921A91F792D28B044A71", user_id: "",
}, "en", "OUT", "OUT", false],
id: 1,
jsonrpc: "2.0",
@ -164,12 +168,14 @@ describe("controller calls", () => {
errorstack: ["(1 elements cleared)"],
},
});
let result = controller.update_identity(testMail, testId, testName, testFp);
let result = controller.update_identity({
address: testMail, user_id: testId, username: testName, fpr: testFp,
});
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",
address: "test@test.com", user_id: "test_user_id", username: "Test User 01", fpr: "B39706EF952EC3AF0BA5921A91F792D28B044A71",
}],
id: 1,
jsonrpc: "2.0",
@ -211,12 +217,14 @@ describe("controller calls", () => {
});
it("trust personal key", () => {
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);
result = controller.trust_personal_key({
address: testMail, user_id: testId, username: testName, fpr: testFp,
});
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",
address: "test@test.com", user_id: "test_user_id", username: "Test User 01", fpr: "B39706EF952EC3AF0BA5921A91F792D28B044A71",
}],
id: 1,
jsonrpc: "2.0",
@ -225,12 +233,14 @@ describe("controller calls", () => {
});
it("identity rating", () => {
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);
result = controller.identity_rating({
address: testMail, user_id: testId, username: testName, fpr: testFp,
});
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",
address: "test@test.com", user_id: "test_user_id", username: "Test User 01", fpr: "B39706EF952EC3AF0BA5921A91F792D28B044A71",
}, ["OP"]],
id: 1,
jsonrpc: "2.0",
@ -286,12 +296,14 @@ describe("controller calls", () => {
});
});
it("key mistrusted", () => {
result = controller.key_mistrusted(testMail, testId, testName, testFp);
result = controller.key_mistrusted({
address: testMail, user_id: testId, username: testName, fpr: testFp,
});
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",
address: "test@test.com", user_id: "test_user_id", username: "Test User 01", fpr: "B39706EF952EC3AF0BA5921A91F792D28B044A71",
}],
id: 1,
jsonrpc: "2.0",
@ -299,12 +311,14 @@ describe("controller calls", () => {
return result.should.become([]);
});
it("key reset trust", () => {
result = controller.key_reset_trust(testMail, testId, testName, testFp);
result = controller.key_reset_trust({
address: testMail, user_id: testId, username: testName, fpr: testFp,
});
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",
address: "test@test.com", user_id: "test_user_id", username: "Test User 01", fpr: "B39706EF952EC3AF0BA5921A91F792D28B044A71",
}],
id: 1,
jsonrpc: "2.0",


Loading…
Cancel
Save