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.

18 lines
498 B

  1. from django.test import TestCase
  2. from hc.lib.badges import get_width, get_badge_svg
  3. class BadgesTestCase(TestCase):
  4. def test_get_width_works(self):
  5. self.assertEqual(get_width("mm"), 20)
  6. # Default width for unknown characters is 7
  7. self.assertEqual(get_width("@"), 7)
  8. def test_it_makes_svg(self):
  9. svg = get_badge_svg("foo", "up")
  10. self.assertTrue("#4c1" in svg)
  11. svg = get_badge_svg("bar", "down")
  12. self.assertTrue("#e05d44" in svg)