from hc.test import BaseTestCase from hc.api.models import Check class BadgesTestCase(BaseTestCase): def test_it_shows_badges(self): self.client.login(username="alice@example.org", password="password") Check.objects.create(project=self.project, tags="foo a-B_1 baz@") Check.objects.create(project=self.bobs_project, tags="bobs-tag") r = self.client.get("/accounts/profile/badges/") self.assertContains(r, "foo.svg") self.assertContains(r, "a-B_1.svg") # Expect badge URLs only for tags that match \w+ self.assertNotContains(r, "baz@.svg") # Expect only Alice's tags self.assertNotContains(r, "bobs-tag.svg")