Add logged user and user communities endpoint
This commit is contained in:
parent
ddcc591d12
commit
a85330e8cf
7 changed files with 180 additions and 3 deletions
|
|
@ -23,6 +23,12 @@ test("can register", async () => {
|
|||
state.userId = response.id;
|
||||
});
|
||||
|
||||
test("shouldn't be authorized to get logged user", async () => {
|
||||
const response = await apiGet(`user/logged`);
|
||||
|
||||
assert.equal(response.error, "ACCESS_DENIED");
|
||||
});
|
||||
|
||||
test("shouldn't be able to login", async () => {
|
||||
const response = await apiPost(`auth/login`, {
|
||||
username: state.username,
|
||||
|
|
@ -48,6 +54,12 @@ test("can login", async () => {
|
|||
state.token = response.token;
|
||||
});
|
||||
|
||||
test("can get logged user", async () => {
|
||||
const response = await apiGet(`user/logged`, state.token);
|
||||
|
||||
assert.equal(response.id, state.userId);
|
||||
});
|
||||
|
||||
test("shouldn't be authorized to get user", async () => {
|
||||
const response1 = await apiGet(`user/${state.userId}`);
|
||||
assert.equal(response1.error, "ACCESS_DENIED");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue