Compare commits
3 Commits
jwesson/in
...
swayamrana
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d8fc0fb2e0 | ||
|
|
05c916171a | ||
|
|
5b676408e4 |
@@ -3,21 +3,6 @@
|
||||
"name": "frontend-app-profile"
|
||||
},
|
||||
"interactions": [
|
||||
{
|
||||
"description": "A request for user's basic information",
|
||||
"providerStates": [
|
||||
{
|
||||
"name": "Account and user's information does not exist"
|
||||
}
|
||||
],
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"path": "/api/user/v1/accounts/staff_not_found"
|
||||
},
|
||||
"response": {
|
||||
"status": 404
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "A request for user's basic information",
|
||||
"providerStates": [
|
||||
@@ -30,13 +15,16 @@
|
||||
"path": "/api/user/v1/accounts/staff"
|
||||
},
|
||||
"response": {
|
||||
"status": 200,
|
||||
"body": {
|
||||
"bio": "This is my bio",
|
||||
"country": "ME",
|
||||
"dateJoined": "2017-06-07T00:44:23Z",
|
||||
"email": "staff@example.com",
|
||||
"gender": "m",
|
||||
"goals": "Learn and Grow!",
|
||||
"isActive": true,
|
||||
"mailingAddress": "Park Ave",
|
||||
"name": "Lemon Seltzer",
|
||||
"phoneNumber": "+11234567890",
|
||||
"username": "staff",
|
||||
"yearOfBirth": 1901
|
||||
},
|
||||
@@ -44,18 +32,37 @@
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
"matchingRules": {
|
||||
"body": {
|
||||
"$": {
|
||||
"combine": "AND",
|
||||
"matchers": [
|
||||
{
|
||||
"match": "type"
|
||||
}
|
||||
]
|
||||
}
|
||||
"$.body.bio": {
|
||||
"match": "type"
|
||||
},
|
||||
"$.body.country": {
|
||||
"match": "type"
|
||||
},
|
||||
"$.body.gender": {
|
||||
"match": "type"
|
||||
},
|
||||
"$.body.goals": {
|
||||
"match": "type"
|
||||
},
|
||||
"$.body.isActive": {
|
||||
"match": "type"
|
||||
},
|
||||
"$.body.mailingAddress": {
|
||||
"match": "type"
|
||||
},
|
||||
"$.body.name": {
|
||||
"match": "type"
|
||||
},
|
||||
"$.body.phoneNumber": {
|
||||
"match": "type"
|
||||
},
|
||||
"$.body.username": {
|
||||
"match": "type"
|
||||
},
|
||||
"$.body.yearOfBirth": {
|
||||
"match": "type"
|
||||
}
|
||||
},
|
||||
"status": 200
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
@@ -9,13 +9,15 @@ import { initializeMockApp, getConfig, setConfig } from '@edx/frontend-platform'
|
||||
import { getAccount } from './services';
|
||||
|
||||
const expectedUserInfo200 = {
|
||||
username: 'staff',
|
||||
email: 'staff@example.com',
|
||||
bio: 'This is my bio',
|
||||
name: 'Lemon Seltzer',
|
||||
country: 'ME',
|
||||
dateJoined: '2017-06-07T00:44:23Z',
|
||||
gender: 'm',
|
||||
goals: 'Learn and Grow!',
|
||||
isActive: true,
|
||||
mailingAddress: 'Park Ave',
|
||||
name: 'Lemon Seltzer',
|
||||
phoneNumber: '+11234567890',
|
||||
username: 'staff',
|
||||
yearOfBirth: 1901,
|
||||
};
|
||||
|
||||
@@ -55,26 +57,4 @@ describe('getAccount for one username', () => {
|
||||
expect(response).toEqual(expectedUserInfo200);
|
||||
});
|
||||
});
|
||||
|
||||
it('Account does not exist', async () => {
|
||||
const username404 = 'staff_not_found';
|
||||
await provider.addInteraction({
|
||||
states: [{ description: "Account and user's information does not exist" }],
|
||||
uponReceiving: "A request for user's basic information",
|
||||
withRequest: {
|
||||
method: 'GET',
|
||||
path: `/api/user/v1/accounts/${username404}`,
|
||||
},
|
||||
willRespondWith: {
|
||||
status: 404,
|
||||
},
|
||||
});
|
||||
await provider.executeTest(async (mockserver) => {
|
||||
setConfig({
|
||||
...getConfig(),
|
||||
LMS_BASE_URL: mockserver.url,
|
||||
});
|
||||
await expect(getAccount(username404).then((response) => response.data)).rejects.toThrow('Request failed with status code 404');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user