From d633f080176a90bd2ca375b0a05c1cf9da049e15 Mon Sep 17 00:00:00 2001 From: James Chartrand Date: Mon, 9 Sep 2024 10:36:35 -0400 Subject: [PATCH] finish tests --- src/app.test.js | 8 ++++++-- src/test-fixtures/.env.testing | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/app.test.js b/src/app.test.js index 56982ee..7981d7a 100644 --- a/src/app.test.js +++ b/src/app.test.js @@ -23,9 +23,12 @@ import { resetConfig } from './config.js' const exchangeSetupPath = '/exchange/setup' const unprotectedTenantName = "UN_PROTECTED_TEST" const protectedTenantName = "PROTECTED_TEST" +const protectedTenantName2 = "PROTECTED_TEST_2" const randomTenantName = "RANDOM_TEST" + let unprotectedTenantToken let protectedTenantToken +let testTenantToken2 let randomToken let statusUpdateBody @@ -49,6 +52,7 @@ describe('api', () => { before(async () => { unprotectedTenantToken = process.env[`TENANT_TOKEN_${unprotectedTenantName}`] protectedTenantToken = process.env[`TENANT_TOKEN_${protectedTenantName}`] + testTenantToken2 = process.env[`TENANT_TOKEN_${protectedTenantName2}`] randomToken = process.env[`TENANT_TOKEN_${randomTenantName}`] statusUpdateBody = { "credentialId": "urn:uuid:951b475e-b795-43bc-ba8f-a2d01efd2eb1", "credentialStatus": [{ "type": "BitstringStatusListCredential", "status": "revoked" }] } }); @@ -393,14 +397,14 @@ describe('api', () => { .expect('Content-Type', /json/) }) - /* it('returns 403 when trying to use token for a different tenant', done => { + it('returns 403 when trying to use token for a different tenant', done => { request(app) .post(`/instance/${protectedTenantName}/credentials/status`) .set('Authorization', `Bearer ${testTenantToken2}`) .send(statusUpdateBody) .expect('Content-Type', /json/) .expect(403, done) - }) */ + }) it('update unprotected status when token not set for tenant in config', done => { diff --git a/src/test-fixtures/.env.testing b/src/test-fixtures/.env.testing index e45288f..bb7af71 100644 --- a/src/test-fixtures/.env.testing +++ b/src/test-fixtures/.env.testing @@ -25,6 +25,7 @@ TENANT_TOKEN_UN_PROTECTED_TEST=UNPROTECTED TENANT_TOKEN_PROTECTED_TEST=jds +TENANT_TOKEN_PROTECTED_TEST_2=hgf TENANT_TOKEN_RANDOM_TEST=UNPROTECTED # The tenant name is specified in the issuing/status invocations like so