aboutsummaryrefslogtreecommitdiffstats
path: root/python/tests/web_editgroup.py
blob: 906c18e64fad3ab40ca7332e7864951e64ca5910 (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
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
66
67
68
from fixtures import *


def test_editgroup_basics(app):

    rv = app.get("/editgroup/aaaaaaaaaaaabo53aaaaaaaaae")
    assert rv.status_code == 200
    rv = app.get("/editgroup/aaaaaaaaaaaabo53aaaaaaaaae/diff")
    assert rv.status_code == 200
    rv = app.get("/editgroup/aaaaaaaaaaaabo53aaaaaaaaa4/diff")
    assert rv.status_code == 200
    rv = app.get("/editgroup/aaaaaaaaaaaabo53aaaaaaaaaq/diff")
    assert rv.status_code == 200
    rv = app.get("/editgroup/ccccccccccccccccccccccccca")
    assert rv.status_code == 404
    rv = app.get("/editgroup/ccccccccccccccccccccccccca/diff")
    assert rv.status_code == 404

    rv = app.get("/editor/aaaaaaaaaaaabkvkaaaaaaaaae")
    assert rv.status_code == 200
    rv = app.get("/editor/ccccccccccccccccccccccccca")
    assert rv.status_code == 404
    rv = app.get("/editor/aaaaaaaaaaaabkvkaaaaaaaaae/editgroups")
    assert rv.status_code == 200
    rv = app.get("/editor/ccccccccccccccccccccccccca/editgroups")
    assert rv.status_code == 404

    rv = app.get("/changelog")
    assert rv.status_code == 200
    rv = app.get("/changelog/1")
    assert rv.status_code == 200
    rv = app.get("/changelog/1.3")
    assert rv.status_code == 404
    rv = app.get("/changelog/9999999")
    assert rv.status_code == 404

    rv = app.get("/reviewable")
    assert rv.status_code == 200


def test_editgroup_annotations(app):

    rv = app.get("/editgroup/aaaaaaaaaaaabo53aaaaaaaaa4")
    assert rv.status_code == 200
    assert b"updated with changes, please re-review" in rv.data
    assert b"concerns about this edit..." in rv.data
    assert b"Admin" in rv.data
    assert b"demo-user" in rv.data
    assert b"claire" in rv.data
    assert b"Signup" in rv.data
    assert b"Add Comment" not in rv.data

    rv = app.get("/editor/aaaaaaaaaaaabkvkaaaaaaaaaq/annotations")
    assert rv.status_code == 200
    assert b"updated with changes, please re-review" not in rv.data
    assert b"concerns about this edit..." in rv.data
    assert b"Admin" not in rv.data
    assert b"claire" in rv.data
    assert b"aaaaaaaaaaaabo53aaaaaaaaa4" in rv.data


def test_editgroup_annotations_login(app_admin):

    # if logged in, should see form
    rv = app_admin.get("/editgroup/aaaaaaaaaaaabo53aaaaaaaaa4")
    assert rv.status_code == 200
    assert b"Signup" not in rv.data
    assert b"Add Comment" in rv.data