tests.test_api_aliases   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 23
dl 0
loc 38
rs 10
c 0
b 0
f 0
wmc 1

1 Function

Rating   Name   Duplication   Size   Complexity  
A describe_get() 0 30 1
1
# pylint: disable=unused-variable,misplaced-comparison-constant,expression-not-assigned
2
3
from expecter import expect
0 ignored issues
show
introduced by
Unable to import 'expecter'
Loading history...
4
5
from .utils import load
6
7
8
def describe_get():
9
10
    def it_redirects_with_param(client):
11
        status, data = load(client.get("/api/aliases/?name=foo"))
12
13
        expect(status) == 302
14
        expect(data).contains('<a href="/api/aliases/foo">')
15
16
    def describe_filter():
17
18
        def with_single_match(client):
19
            status, data = load(client.get("/api/aliases/sad-biden"))
20
21
            expect(status) == 200
22
            expect(data) == {
23
                'sad-biden': {
24
                    'styles': [
25
                        'down',
26
                        'scowl',
27
                        'window',
28
                    ],
29
                    'template': "http://localhost/api/templates/sad-biden"
30
                }
31
            }
32
33
        def with_many_matches(client):
34
            status, data = load(client.get("/api/aliases/votestakes"))
35
36
            expect(status) == 200
37
            expect(len(data)) == 5
38