Example #1
0
 def test_toggle_badge_off(self):
     ps_badge = OrganizationBadge(kind=PUBLIC_SERVICE)
     certified_badge = OrganizationBadge(kind=CERTIFIED)
     org = OrganizationFactory(badges=[ps_badge, certified_badge])
     toggle(str(org.id), PUBLIC_SERVICE)
     org.reload()
     self.assertEqual(org.badges[0].kind, CERTIFIED)
Example #2
0
 def test_toggle_badge_off(self):
     ps_badge = OrganizationBadge(kind=PUBLIC_SERVICE)
     certified_badge = OrganizationBadge(kind=CERTIFIED)
     org = OrganizationFactory(badges=[ps_badge, certified_badge])
     toggle(str(org.id), PUBLIC_SERVICE)
     org.reload()
     self.assertEqual(org.badges[0].kind, CERTIFIED)
Example #3
0
    def test_toggle_badge_on_from_file(self):
        orgs = [OrganizationFactory() for _ in range(2)]

        with NamedTemporaryFile() as temp:
            temp.write('\n'.join((str(org.id) for org in orgs)))
            temp.flush()

            toggle(temp.name, PUBLIC_SERVICE)

        for org in orgs:
            org.reload()
            self.assertEqual(org.badges[0].kind, PUBLIC_SERVICE)
Example #4
0
    def test_toggle_badge_on_from_file(self):
        orgs = [OrganizationFactory() for _ in range(2)]

        with NamedTemporaryFile() as temp:
            temp.write('\n'.join((str(org.id) for org in orgs)))
            temp.flush()

            toggle(temp.name, PUBLIC_SERVICE)

        for org in orgs:
            org.reload()
            self.assertEqual(org.badges[0].kind, PUBLIC_SERVICE)
Example #5
0
 def test_toggle_badge_on(self):
     org = OrganizationFactory()
     toggle(str(org.id), PUBLIC_SERVICE)
     org.reload()
     self.assertEqual(org.badges[0].kind, PUBLIC_SERVICE)
Example #6
0
 def test_toggle_badge_on(self):
     org = OrganizationFactory()
     toggle(str(org.id), PUBLIC_SERVICE)
     org.reload()
     self.assertEqual(org.badges[0].kind, PUBLIC_SERVICE)