예제 #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)
예제 #2
0
파일: test_badges.py 프로젝트: grouan/udata
 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)
예제 #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)
예제 #4
0
파일: test_badges.py 프로젝트: grouan/udata
    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)
예제 #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)
예제 #6
0
파일: test_badges.py 프로젝트: grouan/udata
 def test_toggle_badge_on(self):
     org = OrganizationFactory()
     toggle(str(org.id), PUBLIC_SERVICE)
     org.reload()
     self.assertEqual(org.badges[0].kind, PUBLIC_SERVICE)