Skip to content

Commit

Permalink
Lowercase boolean flags
Browse files Browse the repository at this point in the history
  • Loading branch information
jacebrowning committed May 16, 2017
1 parent 300b4af commit 7f60aa6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion memegen/routes/latest.py
Expand Up @@ -10,9 +10,10 @@
@blueprint.route("/latest")
@flaskparser.use_kwargs({'nsfw': fields.Bool(missing=False)})
def get(nsfw):
filtered = 'false' if nsfw else 'true'
return render_template(
'latest.html',
srcs=[route('image.get_latest', index=i, filtered=not nsfw)
srcs=[route('image.get_latest', index=i, filtered=filtered)
for i in range(30)],
refresh=60,
config=current_app.config,
Expand Down
4 changes: 2 additions & 2 deletions tests/test_images.py
Expand Up @@ -218,7 +218,7 @@ def it_filters_blocked_words(client, enable_cache):
expect(load(response, as_json=False)).excludes(
'<a href="http://localhost/iw/nazis.jpg">')

response = client.get("/latest.jpg?filtered=False")
response = client.get("/latest.jpg?filtered=false")

expect(response.status_code) == 302
expect(load(response, as_json=False)).contains(
Expand All @@ -233,7 +233,7 @@ def it_filters_custom_images(client, enable_cache):
expect(load(response, as_json=False)).excludes(
'<a href="http://localhost/custom/test.jpg">')

response = client.get("/latest.jpg?filtered=False")
response = client.get("/latest.jpg?filtered=false")

expect(response.status_code) == 302
expect(load(response, as_json=False)).contains(
Expand Down
4 changes: 2 additions & 2 deletions tests/test_latest.py
Expand Up @@ -11,12 +11,12 @@ def it_returns_filtered_images_by_default(client):
expect(response.status_code) == 200
expect(response.mimetype) == 'text/html'
expect(response.get_data(as_text=True)).contains(
'src="/latest1.jpg?filtered=True"')
'src="/latest1.jpg?filtered=true"')

def it_returns_unfiltered_images_when_nsfw(client):
response = client.get("/latest?nsfw=true")

expect(response.status_code) == 200
expect(response.mimetype) == 'text/html'
expect(response.get_data(as_text=True)).contains(
'src="/latest1.jpg?filtered=False"')
'src="/latest1.jpg?filtered=false"')

0 comments on commit 7f60aa6

Please sign in to comment.