aboutsummaryrefslogtreecommitdiffstats
path: root/python/tests/routes.py
blob: 80eb15fe4d1d9ef30f6fc374c8e282c0ae35bd04 (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

import json
import tempfile
import pytest
import fatcat
from fixtures import *


def test_static_routes(app):
    for route in ('/health', '/robots.txt', '/', '/about'):
        rv = app.get(route)
        assert rv.status_code == 200

    assert app.get("/static/bogus/route").status_code == 404


def test_all_views(app):
    for route in ('work', 'release', 'creator', 'container', 'file'):
        print(route)
        rv = app.get('/{}/1'.format(route))
        assert rv.status_code == 200

        rv = app.get('/{}/999999999999'.format(route))
        assert rv.status_code == 404

    rv = app.get('/work/random')
    rv = app.get(rv.location)
    assert rv.status_code == 200

    rv = app.get('/work/random')
    assert rv.status_code == 302

    rv = app.get('/work/create')
    assert rv.status_code == 200

    rv = app.get('/release/random')
    assert rv.status_code == 302

    rv = app.get('/release/1/changelog')
    assert rv.status_code == 200

    rv = app.get('/editgroup/1')
    assert rv.status_code == 200

    rv = app.get('/editgroup/99999999')
    assert rv.status_code == 404

    rv = app.get('/editgroup/current')
    assert rv.status_code == 302

    rv = app.get('/editor/admin')
    assert rv.status_code == 200

    rv = app.get('/editor/bizzaro')
    assert rv.status_code == 404

    rv = app.get('/editor/admin/changelog')
    assert rv.status_code == 200

    rv = app.get('/editor/bizarro/changelog')
    assert rv.status_code == 404