Skip to content

Commit

Permalink
#140 - fixed reset_password response
Browse files Browse the repository at this point in the history
- added Bruno request
  • Loading branch information
jbc25 committed May 22, 2024
1 parent b121c24 commit 94f357e
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 5 deletions.
38 changes: 38 additions & 0 deletions api/client/Auth/Reset password.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
meta {
name: Reset password
type: http
seq: 3
}

post {
url: {{URL}}/api/v2/reset_password/
body: formUrlEncoded
auth: none
}

body:form-urlencoded {
email: %7B%7Bemail%7D%7D
}

script:post-response {

let data = res.getBody();
let token = bru.setEnvVar("token", data.token);
}

tests {
test("should be able to login", function() {
const data = res.getBody();
expect(res.getStatus()).to.equal(200);
});

test("should receive the token", function() {
const data = res.getBody();
expect(data.token).to.be.a('string');
});

test("should receive the user_id", function() {
const data = res.getBody();
expect(data.user_id).to.be.a('number');
});
}
3 changes: 2 additions & 1 deletion api/client/environments/DEV.bru
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ vars:secret [
password,
token,
node_id,
provider_uuid
provider_uuid,
email
]
5 changes: 3 additions & 2 deletions api/client/environments/PROD.bru
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
vars {
URL: https://appmes.triskelapps.com
URL: https://app.mercadosocial.net
username: [email protected]
}
vars:secret [
password,
token,
node_id,
provider_uuid
provider_uuid,
email
]
3 changes: 2 additions & 1 deletion api/client/environments/STAGING.bru
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ vars:secret [
password,
token,
node_id,
provider_uuid
provider_uuid,
email
]
2 changes: 1 addition & 1 deletion api/views/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def post(self, request, *args, **kwargs):
reset_form = PasswordReset(request.data)
if reset_form.is_valid():
reset_form.save()
return Response(status=status.HTTP_200_OK)
return Response(status=status.HTTP_200_OK, data={})
else:
return Response(status=status.HTTP_400_BAD_REQUEST, data=reset_form.errors)
except User.DoesNotExist:
Expand Down

0 comments on commit 94f357e

Please sign in to comment.