You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
789 B

6 years ago
  1. from hc.test import BaseTestCase
  2. from hc.api.models import Check
  3. class BadgesTestCase(BaseTestCase):
  4. def test_it_shows_badges(self):
  5. self.client.login(username="[email protected]", password="password")
  6. Check.objects.create(user=self.alice, tags="foo a-B_1 baz@",
  7. project=self.project)
  8. Check.objects.create(user=self.bob, tags="bobs-tag",
  9. project=self.bobs_project)
  10. r = self.client.get("/accounts/profile/badges/")
  11. self.assertContains(r, "foo.svg")
  12. self.assertContains(r, "a-B_1.svg")
  13. # Expect badge URLs only for tags that match \w+
  14. self.assertNotContains(r, "[email protected]")
  15. # Expect only Alice's tags
  16. self.assertNotContains(r, "bobs-tag.svg")