Example #1
0
 def test_about_has_correct_title(self, client):
     response = client.get('/about/')
     soup = BeautifulSoup(response.content, 'html.parser')
     title = soup.find_all('title')
     assert len(title) == 1, "only one title"
     assert 'MisoBoop | About' == strip_leading_trailing_spaces(
         title[0].text), "title is MisoBoop | About"
Example #2
0
 def test_post_detail_has_correct_title(self, client, post_factory):
     post = post_factory(headline="test_post")
     response = client.get(post.get_absolute_url())
     soup = BeautifulSoup(response.content, 'html.parser')
     title = soup.find_all('title')
     assert len(title) == 1, "only one title"
     assert 'MisoBoop | test_post' == strip_leading_trailing_spaces(
         title[0].text), "title is MisoBoop | test_post"
Example #3
0
 def test_recipe_explore_title(self, client):
     response = client.get('/recipes/explore/')
     assert response.status_code == 200
     soup = BeautifulSoup(response.content, 'html.parser')
     title = soup.find_all('title')
     assert len(title) == 1, "only one title"
     assert strip_leading_trailing_spaces(
         title[0].text) == 'MisoBoop | Explore recipes', "title is correct"
Example #4
0
def test_strip_leading_trailing_spaces(input, expected):
    assert strip_leading_trailing_spaces(input) == expected