Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Trevor Austin
/
mpcs-52553-austin-winter-2021
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Pipelines
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
68501690
authored
Mar 10, 2021
by
Trevor Austin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add sample tests
parent
3078d13b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
4 deletions
week_9/examples/passwords_with_tests/test_bcrypt_example.py
week_9/examples/passwords_with_tests/test_bcrypt_example.py
View file @
68501690
...
...
@@ -19,10 +19,22 @@ def test_static_html(client):
def
test_signup_and_login
(
client
):
"""Tests that I can log in with new credentials"""
new_username
=
"something cool"
new_password
=
"something weird"
new_username
=
"something cool
2
"
new_password
=
"something weird
2
"
client
.
post
(
'/api/signup'
,
json
=
{
'username'
:
new_username
,
'password'
:
new_password
})
#
client.post('/api/signup', json = {'username':new_username, 'password':new_password})
# response = try to log in with new_username and new_password
response
=
client
.
post
(
'/api/login'
,
json
=
{
'username'
:
new_username
,
'password'
:
new_password
})
assert
response
.
status
==
"200 OK"
def
test_wrong_password
(
client
):
"""Tests that I can log in with new credentials"""
new_username
=
"something cool2"
new_password
=
"wrong password"
response
=
client
.
post
(
'/api/login'
,
json
=
{
'username'
:
new_username
,
'password'
:
new_password
})
assert
response
.
status
==
"404 NOT FOUND"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment