Completed
Pull Request — master (#244)
by Jace
10:30
created

with_bottom_only()   A

Complexity

Conditions 2

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
c 1
b 0
f 0
dl 0
loc 7
rs 9.4285
1
# pylint: disable=unused-variable,misplaced-comparison-constant,expression-not-assigned
0 ignored issues
show
introduced by
Bad option value 'misplaced-comparison-constant'
Loading history...
2
3
from expecter import expect
0 ignored issues
show
Configuration introduced by
The import expecter could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
4
5
from .conftest import load
6
7
8
def describe_get():
9
10
    def it_returns_link_options(client):
11
        response = client.get("/api/templates/iw/hello/world")
12
13
        expect(response.status_code) == 200
14
        assert dict(
15
            direct=dict(
16
                visible="http://localhost/iw/hello/world.jpg",
17
                masked="http://localhost/_aXcJaGVsbG8vd29ybGQJ.jpg",
18
            ),
19
            markdown=dict(
20
                visible="![iw](http://localhost/iw/hello/world.jpg)",
21
                masked="![iw](http://localhost/_aXcJaGVsbG8vd29ybGQJ.jpg)",
22
            ),
23
        ) == load(response)
24
25
    def with_top_only(client):
26
        response = client.get("/api/templates/iw/hello")
27
28
        expect(response.status_code) == 200
29
        assert dict(
30
            visible="http://localhost/iw/hello.jpg",
31
            masked="http://localhost/_aXcJaGVsbG8J.jpg",
32
        ) == load(response, key='direct')
33
34
    def with_bottom_only(client):
35
        response = client.get("/api/templates/iw/_/hello")
36
37
        expect(response.status_code) == 200
38
        assert dict(
39
            visible="http://localhost/iw/_/hello.jpg",
40
            masked="http://localhost/_aXcJXy9oZWxsbwkJ.jpg",
41
        ) == load(response, key='direct')
42
43
    def with_dashes(client):
44
        response = client.get("/api/templates/iw/HelloThere_World/How-areYOU")
45
46
        expect(response.status_code) == 302
47
        assert '<a href="/api/templates/iw/hello-there-world/how-are-you">' in \
48
            load(response, as_json=False)
49
50
    def when_masked(client):
51
        response = client.get("/_aXcJaGVsbG8vd29ybGQJ")
52
53
        expect(response.status_code) == 302
54
        assert '<a href="/api/templates/iw/hello/world">' in load(response, as_json=False)
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (90/80).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
55
56
    def when_masked_with_1_line(client):
57
        response = client.get("/_aXcJaGVsbG8J")
58
59
        expect(response.status_code) == 302
60
        assert '<a href="/api/templates/iw/hello">' in load(response, as_json=False)
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (84/80).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
61
62
    def when_alias(client):
63
        response = client.get("/api/templates/insanity-wolf")
64
65
        expect(response.status_code) == 302
66
        assert '<a href="/api/templates/iw">' in load(response, as_json=False)
67
68
    def when_alias_with_text(client):
69
        response = client.get("/api/templates/insanity-wolf/hello/world")
70
71
        expect(response.status_code) == 302
72
        assert '<a href="/api/templates/iw/hello/world">' in load(response, as_json=False)
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (90/80).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
73
74
    def old_api_is_still_supported_via_redirect(client):
75
        response = client.get("/iw/top/bottom")
76
77
        assert 302 == response.status_code
78
        assert '<a href="/api/templates/iw/top/bottom">' in load(response, as_json=False)
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (89/80).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
79