contentdb/app/tests/test_homepage.py

23 lines
581 B
Python
Raw Normal View History

2020-01-19 15:03:38 +00:00
import pytest
from app import app
2020-01-19 15:46:29 +00:00
from app.default_data import populate_test_data
from app.models import db, License, Tag, User, UserRank
2020-01-19 15:03:38 +00:00
from utils import client, recreate_db
2020-01-19 15:46:29 +00:00
def test_homepage_empty(client):
2020-01-19 15:03:38 +00:00
"""Start with a blank database."""
2020-01-19 15:46:29 +00:00
rv = client.get("/")
assert b"No packages available" in rv.data and b"packagetile" not in rv.data
def test_homepage_with_contents(client):
"""Start with a test database."""
2020-01-19 19:09:04 +00:00
populate_test_data(db.session)
2020-01-19 15:46:29 +00:00
db.session.commit()
2020-01-19 15:03:38 +00:00
rv = client.get("/")
2020-01-19 15:46:29 +00:00
assert b"No packages available" not in rv.data and b"packagetile" in rv.data