blob: 0d0679bb4664ab7b1dce38d9290c0a3f409c6a7a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
from fixtures import *
def test_change_username(app_admin):
# these tests aren't supposed to mutate database
rv = app_admin.post('/auth/change_username', data={'username': 'admin-tmp'},
follow_redirects=True)
assert rv.status_code == 200
rv = app_admin.get('/auth/account')
assert b'admin-tmp' in rv.data
rv = app_admin.post('/auth/change_username', data={'username': 'claire'},
follow_redirects=True)
assert rv.status_code == 400
rv = app_admin.get('/auth/account')
assert b'admin-tmp' in rv.data
rv = app_admin.post('/auth/change_username', data={'username': 'admin'},
follow_redirects=True)
assert rv.status_code == 200
rv = app_admin.get('/auth/account')
assert b'admin-tmp' not in rv.data
def test_username_redirect(app_admin):
rv = app_admin.get('/u/admin')
assert rv.status_code == 302
rv = app_admin.get('/u/bogus-not-registered')
assert rv.status_code == 404
|