tests.test_api_aliases.describe_get()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 30
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 20
nop 0
dl 0
loc 30
rs 9.4
c 0
b 0
f 0
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