-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2b7989c
commit 81c25eb
Showing
4 changed files
with
42 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { test, expect } from '@playwright/test'; | ||
import { StatusCodes } from 'http-status-codes'; | ||
import * as fs from 'fs'; | ||
import { CONTENT_TYPE, PAYLOADS_PATH } from '../../constants'; | ||
|
||
test.use({ storageState: 'playwright/.auth/user.json' }); | ||
|
||
test(' Issue accreditation [Negative]: Missing query parameters', async ({ request }) => { | ||
const credentialData = JSON.parse(fs.readFileSync(`${PAYLOADS_PATH.ACCREDITATION}/authorize-jwt.json`, 'utf-8')); | ||
const issueResponse = await request.post(`/trust-registry/accreditation/issue`, { | ||
data: JSON.stringify(credentialData), | ||
headers: { | ||
'Content-Type': CONTENT_TYPE.APPLICATION_JSON, | ||
}, | ||
}); | ||
expect(issueResponse.status()).toBe(StatusCodes.BAD_REQUEST); | ||
}); | ||
|
||
test(' Verify accreditation [Negative]: Missing request body', async ({ request }) => { | ||
const verifyResponse = await request.post(`/trust-registry/accreditation/verify`, { | ||
headers: { | ||
'Content-Type': CONTENT_TYPE.APPLICATION_JSON, | ||
}, | ||
}); | ||
expect(verifyResponse.status()).toBe(StatusCodes.BAD_REQUEST); | ||
}); | ||
|
||
test(' Issue accreditation [Negative]: Invalid schema', async ({ request }) => { | ||
const credentialData = JSON.parse( | ||
fs.readFileSync(`${PAYLOADS_PATH.ACCREDITATION}/invalid-schema-accredit.json`, 'utf-8') | ||
); | ||
const issueResponse = await request.post(`/trust-registry/accreditation/issue?accreditationType=accredit`, { | ||
data: JSON.stringify(credentialData), | ||
headers: { | ||
'Content-Type': CONTENT_TYPE.APPLICATION_JSON, | ||
}, | ||
}); | ||
|
||
expect(issueResponse.status()).toBe(StatusCodes.UNAUTHORIZED); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters