| @@ 134-154 (lines=21) @@ | ||
| 131 | expect(load(response, as_json=False)).contains( |
|
| 132 | '<a href="/sad-biden/hello.jpg">') |
|
| 133 | ||
| 134 | def describe_custom_font(): |
|
| 135 | ||
| 136 | def when_provided(client): |
|
| 137 | response = client.get("/iw/hello.jpg?font=impact") |
|
| 138 | ||
| 139 | expect(response.status_code) == 200 |
|
| 140 | expect(response.mimetype) == 'image/jpeg' |
|
| 141 | ||
| 142 | def it_redirects_on_unknown_fonts(client): |
|
| 143 | response = client.get("/iw/hello.jpg?font=__unknown__") |
|
| 144 | ||
| 145 | expect(response.status_code) == 302 |
|
| 146 | expect(load(response, as_json=False)).contains( |
|
| 147 | '<a href="/iw/hello.jpg">') |
|
| 148 | ||
| 149 | def it_keeps_font_after_redirect(client): |
|
| 150 | response = client.get("/iw/what%3F.jpg?font=impact") |
|
| 151 | ||
| 152 | expect(response.status_code) == 302 |
|
| 153 | expect(load(response, as_json=False)).contains( |
|
| 154 | '<a href="/iw/what~q.jpg?font=impact">') |
|
| 155 | ||
| 156 | def describe_custom_size(): |
|
| 157 | ||
| @@ 6-22 (lines=17) @@ | ||
| 3 | from expecter import expect |
|
| 4 | ||
| 5 | ||
| 6 | def describe_latest(): |
|
| 7 | ||
| 8 | def it_returns_filtered_images_by_default(client): |
|
| 9 | response = client.get("/latest") |
|
| 10 | ||
| 11 | expect(response.status_code) == 200 |
|
| 12 | expect(response.mimetype) == 'text/html' |
|
| 13 | expect(response.get_data(as_text=True)).contains( |
|
| 14 | 'src="/latest1.jpg?filtered=true&') |
|
| 15 | ||
| 16 | def it_returns_unfiltered_images_when_nsfw(client): |
|
| 17 | response = client.get("/latest?nsfw=true") |
|
| 18 | ||
| 19 | expect(response.status_code) == 200 |
|
| 20 | expect(response.mimetype) == 'text/html' |
|
| 21 | expect(response.get_data(as_text=True)).contains( |
|
| 22 | 'src="/latest1.jpg?filtered=false&') |
|
| 23 | ||