Skip to content

Commit

Permalink
adjust tests for beta labels
Browse files Browse the repository at this point in the history
  • Loading branch information
hgy59 committed Jan 1, 2024
1 parent 19ae314 commit 0a42006
Showing 1 changed file with 60 additions and 15 deletions.
75 changes: 60 additions & 15 deletions spkrepo/tests/test_frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_get_logged_user(self):


class PackagesTestCase(BaseTestCase):
def test_get_active_stable(self):
def test_get_active(self):
build = BuildFactory(version__report_url=None, active=True)
db.session.commit()
response = self.client.get(url_for("frontend.packages"))
Expand All @@ -35,45 +35,67 @@ def test_get_active_stable(self):
)
self.assertNotIn("beta", response.data.decode())

def test_get_active_not_stable(self):
build = BuildFactory(active=True)
def test_get_not_active(self):
build = BuildFactory(active=False)
db.session.commit()
response = self.client.get(url_for("frontend.packages"))
self.assert200(response)
self.assertIn(
build.version.displaynames["enu"].displayname,
response.data.decode(),
)
self.assertIn("beta", response.data.decode())

def test_get_not_active_not_stable(self):
build = BuildFactory(active=False)

class PackageTestCase(BaseTestCase):
def test_get_active_stable(self):
build = BuildFactory(
version__package__author=UserFactory(),
version__report_url=None,
active=True,
)
db.session.commit()
response = self.client.get(url_for("frontend.packages"))
response = self.client.get(
url_for("frontend.package", name=build.version.package.name)
)
self.assert200(response)
self.assertNotIn(
for a in build.architectures:
self.assertIn(a.code, response.data.decode())
self.assertIn(
build.version.displaynames["enu"].displayname,
response.data.decode(),
)
self.assertIn(
build.version.descriptions["enu"].description,
response.data.decode(),
)
self.assertNotIn("beta", response.data.decode())

def test_get_not_active_stable(self):
build = BuildFactory(active=False)
build = BuildFactory(
version__package__author=UserFactory(),
version__report_url=None,
active=False,
)
db.session.commit()
response = self.client.get(url_for("frontend.packages"))
response = self.client.get(
url_for("frontend.package", name=build.version.package.name)
)
self.assert200(response)
self.assertNotIn(
for a in build.architectures:
self.assertIn(a.code, response.data.decode())
self.assertIn(
build.version.displaynames["enu"].displayname,
response.data.decode(),
)
self.assertIn(
build.version.descriptions["enu"].description,
response.data.decode(),
)
self.assertNotIn("beta", response.data.decode())


class PackageTestCase(BaseTestCase):
def test_get(self):
def test_get_active_not_stable(self):
build = BuildFactory(
version__package__author=UserFactory(),
version__report_url=None,
active=True,
)
db.session.commit()
Expand All @@ -91,6 +113,29 @@ def test_get(self):
build.version.descriptions["enu"].description,
response.data.decode(),
)
self.assertIn("beta", response.data.decode())

def test_get_not_active_not_stable(self):
build = BuildFactory(
version__package__author=UserFactory(),
active=False,
)
db.session.commit()
response = self.client.get(
url_for("frontend.package", name=build.version.package.name)
)
self.assert200(response)
for a in build.architectures:
self.assertIn(a.code, response.data.decode())
self.assertIn(
build.version.displaynames["enu"].displayname,
response.data.decode(),
)
self.assertIn(
build.version.descriptions["enu"].description,
response.data.decode(),
)
self.assertIn("beta", response.data.decode())

def test_get_no_package(self):
response = self.client.get(url_for("frontend.package", name="no-package"))
Expand Down

0 comments on commit 0a42006

Please sign in to comment.