Skip to content
Snippets Groups Projects
Commit 30aa5fa6 authored by rxd's avatar rxd
Browse files

comments added to tests.

parent 76798f53
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,7 @@ import re
import bs4
def test_generate_empty(client):
"""Test if only no field is valid."""
url = '/generate?top=&url=https%3A%2F%2Flive.staticflickr.com%2F3606%2F3369014165_7441c25d45_q.jpg&bot='
response = client.get(url)
soup = bs4.BeautifulSoup(response.data, "html.parser")
......@@ -23,6 +24,7 @@ def test_generate_empty(client):
assert re.match(first_part_reg, first_part) is not None
def test_generate_one_empty(client):
"""Test if only one field is valid."""
bot_url = '/generate?top=&url=https%3A%2F%2Flive.staticflickr.com%2F3606%2F3369014165_7441c25d45_q.jpg&bot=bot'
top_url = '/generate?top=top&url=https%3A%2F%2Flive.staticflickr.com%2F3606%2F3369014165_7441c25d45_q.jpg&bot='
# bot first
......@@ -46,6 +48,7 @@ def test_generate_one_empty(client):
assert re.match(first_part_reg, first_part) is not None
def check_generate_full(client):
"""Test if fully filled is valid."""
url = '/generate?top=a&url=https%3A%2F%2Flive.staticflickr.com%2F3606%2F3369014165_7441c25d45_q.jpg&bot=c'
response = client.get(url)
soup = bs4.BeautifulSoup(response.data, "html.parser")
......
......@@ -5,17 +5,11 @@ MemeGenerator
Ruizhe Deng rxd@umich.edu
"""
import re
import bs4
def test_images(client):
"""Verify all images are present in / URL.
Note: 'client' is a fixture fuction that provides a Flask test server
interface with a clean database. It is implemented in conftest.py and
reused by many tests. Docs: https://docs.pytest.org/en/latest/fixture.html
"""
"""Test the layout and link in the index page."""
# Load and parse index page
response = client.get("/")
assert response.status_code == 200
......
......@@ -5,17 +5,10 @@ MemeGenerator
Ruizhe Deng rxd@umich.edu
"""
import re
import bs4
def test_search(client):
"""Verify expected links present in / URL.
Note: 'client' is a fixture fuction that provides a Flask test server
interface with a clean database. It is implemented in conftest.py and
reused by many tests. Docs: https://docs.pytest.org/en/latest/fixture.html
"""
def test_check_content(client):
"""Check the search page's content"""
response = client.get("/search/1?q=umich")
assert response.status_code == 200
soup = bs4.BeautifulSoup(response.data, "html.parser")
......@@ -30,6 +23,7 @@ def test_search(client):
assert 'prev' in btns
def test_next_and_prev_page(client):
"""Test if next and prev button works"""
response = client.get("/search/1?q=umich")
assert response.status_code == 200 or response.status_code == 304
soup = bs4.BeautifulSoup(response.data, "html.parser")
......
......@@ -9,6 +9,7 @@ import re
import bs4
def test_layout(client):
"""Test for layout and link."""
response = client.get("http://localhost:8000/setup?url=https%3A%2F%2Flive.staticflickr.com%2F3606%2F3369014165_7441c25d45_q.jpg")
assert response.status_code == 200
soup = bs4.BeautifulSoup(response.data, "html.parser")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment