Skip to content

Commit

Permalink
users: address requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
vhf committed Oct 13, 2019
1 parent 6145356 commit 27d7d6a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
18 changes: 9 additions & 9 deletions src/resources/Users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ export default class Users extends BaseCrud<
constructor(bexioAuth: OAuth2) {
super(
bexioAuth,
"/timesheet_status",
Scopes.MONITORING_SHOW,
Scopes.MONITORING_EDIT
"/user",
Scopes.GENERAL,
Scopes.GENERAL
);
}

Expand All @@ -25,13 +25,13 @@ export default class Users extends BaseCrud<
*
* @param {number} id
* @param {{}} ressource
* @returns {Promise<UsersStatic.UserSmall>}
* @returns {Promise<UsersStatic.UserFull>}
* @memberof Users
*/
public async overwrite(
id: number,
ressource: {}
): Promise<UsersStatic.UserSmall> {
): Promise<UsersStatic.UserFull> {
throw new Error("not implemented by Bexio yet");
}

Expand All @@ -40,25 +40,25 @@ export default class Users extends BaseCrud<
*
* @param {number} id
* @param {{}} ressource
* @returns {Promise<UsersStatic.UserSmall>}
* @returns {Promise<UsersStatic.UserFull>}
* @memberof Users
*/
public async edit(
id: number,
ressource: {}
): Promise<UsersStatic.UserSmall> {
): Promise<UsersStatic.UserFull> {
throw new Error("not implemented by Bexio yet");
}

/**
* Not implemented by Bexio yet
*
* @param {{}} ressource
* @returns {Promise<UsersStatic.UserSmall>}
* @returns {Promise<UsersStatic.UserFull>}
* @memberof Users
*/
public async create(ressource: {}): Promise<
UsersStatic.UserSmall
UsersStatic.UserFull
> {
throw new Error("not implemented by Bexio yet");
}
Expand Down
11 changes: 5 additions & 6 deletions src/tests/Users.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe("Users", function() {
BEXIO_CLIENTID,
BEXIO_CLIENTSECRET,
`http://${HOSTNAME}/callback`,
[Scopes.MONITORING_EDIT, Scopes.MONITORING_SHOW]
[Scopes.GENERAL, Scopes.GENERAL]
);
await api.fakeLogin(BEXIO_USERNAME, BEXIO_PASSWORD);
});
Expand All @@ -53,8 +53,8 @@ describe("Users", function() {
it("should return a not implemented error on creation", async () => {
user = {
id: 1,
firstname: "Alice",
lastname: "Bob",
firstname: "Mathias",
lastname: "Scherer",
is_superadmin: false,
color: "#ff00ff"
};
Expand All @@ -67,13 +67,12 @@ describe("Users", function() {
}
});

it("list useres", async () => {
it("list users", async () => {
const list = await moduleToTest.list({});
expect(list.map(el => el.id)).includes(user.id);
});

// search is currently broken on bexio side
it.skip("search users", async () => {
it("search users", async () => {
const searchResult = await moduleToTest.search({}, [
{
field:
Expand Down

0 comments on commit 27d7d6a

Please sign in to comment.