summaryrefslogtreecommitdiffstats
path: root/tests/routes.py
blob: e389a55f0f5ed01a6d5c2ec4b8a6f93c3859e276 (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

import json
import pytest
import fatcat
import fatcat.sql
import tempfile
from fatcat.models import *
from fixtures import *


def test_static_routes(rich_app):
    app = rich_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(rich_app):
    app = rich_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('/v0/work/random')
        rv = app.get(rv.location)
        assert rv.status_code == 200

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

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

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