contentdb/app/tests/integ/test_homepage.py

38 lines
1.1 KiB
Python
Raw Normal View History

2023-06-19 20:32:36 +02:00
# ContentDB
# Copyright (C) rubenwardy
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
2020-01-19 16:46:29 +01:00
from app.default_data import populate_test_data
2020-12-04 03:23:04 +01:00
from app.models import db
2021-05-03 18:59:23 +02:00
from .utils import client # noqa
2020-12-04 03:23:04 +01:00
2020-01-19 16:03:38 +01:00
2020-01-19 16:46:29 +01:00
def test_homepage_empty(client):
2020-01-19 16:03:38 +01:00
"""Start with a blank database."""
2020-01-19 16:46:29 +01:00
rv = client.get("/")
2021-05-03 18:59:23 +02:00
assert b"No packages available" in rv.data and b"packagegridscrub" not in rv.data
2020-01-19 16:46:29 +01:00
def test_homepage_with_contents(client):
"""Start with a test database."""
2020-01-19 20:09:04 +01:00
populate_test_data(db.session)
2020-01-19 16:46:29 +01:00
db.session.commit()
2020-01-19 16:03:38 +01:00
rv = client.get("/")
2020-01-19 16:46:29 +01:00
2021-05-03 18:59:23 +02:00
assert b"packagegridscrub" in rv.data