mirror of
https://github.com/wallabag/docker
synced 2025-12-13 17:56:31 +00:00
i use requests to test login. the session should be saved and this should work. but i get a error that th session expired. to run this start wallabag and run it with pytest: `py.test -s tests/`. it will output the html of the response.
27 lines
507 B
Python
27 lines
507 B
Python
import requests
|
|
|
|
|
|
URL = 'http://127.0.0.1:80'
|
|
|
|
|
|
def test_login_page():
|
|
r = requests.get(URL, allow_redirects=True)
|
|
|
|
assert r.status_code == 200
|
|
assert 'Login' in r.text
|
|
assert 'Password' in r.text
|
|
assert 'Register' in r.text
|
|
assert 'Username' in r.text
|
|
|
|
|
|
def test_login():
|
|
with requests.Session() as s:
|
|
|
|
data = {
|
|
'_username': 'wallabag',
|
|
'_password': 'wallabag'
|
|
}
|
|
|
|
r = s.post(URL + '/login_check', data=data)
|
|
print(r.text)
|