-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathtest_profile.py
65 lines (54 loc) · 1.92 KB
/
test_profile.py
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
from flask import url_for
from tests.base import TestBaseCase
class ProfileTests(TestBaseCase):
def test_profile(self) -> None:
c = self.client
rv = c.get(url_for('profile_settings', category='profile'))
assert b'[email protected]' in rv.data
rv = c.post(
url_for('profile_settings', category='profile'),
data={
'name': 'Alice Abernathy',
'email': '[email protected]',
'show_email': ''},
follow_redirects=True)
assert b'saved' in rv.data and b'Alice Abernathy' in rv.data
rv = c.post(
url_for('profile_settings', category='display'),
data={
'language': 'en',
'table_rows': 10,
'map_zoom_default': 10,
'map_zoom_max': 10},
follow_redirects=True)
assert b'saved' in rv.data
rv = c.get(url_for('profile_password'))
assert b'old password' in rv.data
new_pass = 'you_never_guess_this'
data = {
'password_old': 'test',
'password': new_pass,
'password2': new_pass}
rv = c.post(
url_for('profile_password'),
data=data,
follow_redirects=True)
assert b'Your password has been updated' in rv.data
data['password2'] = 'short'
rv = c.post(
url_for('profile_password'),
data=data,
follow_redirects=True)
assert b'match' in rv.data
data['password_old'] = new_pass
rv = c.post(
url_for('profile_password'),
data=data,
follow_redirects=True)
assert b'New password is like old one' in rv.data
data['password'] = 'short'
rv = c.post(
url_for('profile_password'),
data=data,
follow_redirects=True)
assert b'too short' in rv.data