Add robot tests
This commit is contained in:
@@ -56,6 +56,10 @@ export class UsersService {
|
||||
data: Prisma.UserUpdateInput;
|
||||
}): Promise<User> {
|
||||
const { where, data } = params;
|
||||
if (typeof data.password === 'string')
|
||||
data.password = await bcrypt.hash(data.password, 8);
|
||||
else if (data.password && data.password.set)
|
||||
data.password = await bcrypt.hash(data.password.set, 8);
|
||||
return this.prisma.user.update({
|
||||
data,
|
||||
where,
|
||||
|
||||
@@ -59,3 +59,44 @@ Login
|
||||
Should Be Equal As Strings ${res["body"]} ${me["body"]}
|
||||
|
||||
[Teardown] DELETE /auth/me
|
||||
|
||||
LoginAsGuest
|
||||
[Documentation] Login as a guest
|
||||
&{res}= POST /auth/guest
|
||||
Output
|
||||
Integer response status 200
|
||||
String response body access_token
|
||||
Set Headers {"Authorization": "Bearer ${res.body.access_token}"}
|
||||
|
||||
${res}= GET /auth/me
|
||||
Output
|
||||
Integer response status 200
|
||||
Boolean response body isGuest true
|
||||
|
||||
[Teardown] DELETE /auth/me
|
||||
|
||||
GuestToNormal
|
||||
[Documentation] Login as a guest and convert to a normal account
|
||||
&{res}= POST /auth/guest
|
||||
Output
|
||||
Integer response status 200
|
||||
String response body access_token
|
||||
Set Headers {"Authorization": "Bearer ${res.body.access_token}"}
|
||||
|
||||
${res}= GET /auth/me
|
||||
Output
|
||||
Integer response status 200
|
||||
Boolean response body isGuest true
|
||||
|
||||
${res}= PUT /auth/me { "username": "toto", "passord": "toto", "email": "a@b.c"}
|
||||
Output
|
||||
Integer response status 200
|
||||
Boolean response body isGuest true
|
||||
|
||||
${res}= GET /auth/me
|
||||
Output
|
||||
Integer response status 200
|
||||
String response body username "toto"
|
||||
Boolean response body isGuest false
|
||||
|
||||
[Teardown] DELETE /auth/me
|
||||
|
||||
Reference in New Issue
Block a user