コード例 #1
0
ファイル: test_views.py プロジェクト: azizur77/etools
 def test_list_switches_only(self):
     country = CountryFactory()
     connection.tenant = country
     tenant_switch = TenantSwitchFactory(countries=[country])
     nontenant_switch = TenantSwitchFactory(countries=[])
     rsp = self.forced_auth_req('get', self.url)
     self.assertEqual(rsp.status_code, status.HTTP_200_OK)
     active_flags = json.loads(rsp.content)['active_flags']
     self.assertIn(tenant_switch.name, active_flags)
     self.assertNotIn(nontenant_switch.name, active_flags)
コード例 #2
0
ファイル: test_views.py プロジェクト: azizur77/etools
 def test_returns_both_flags_and_switches(self):
     country = CountryFactory()
     connection.tenant = country
     tenant_switch = TenantSwitchFactory(countries=[country])
     nontenant_switch = TenantSwitchFactory(countries=[])
     everyone_flag = TenantFlagFactory(everyone=True)
     rsp = self.forced_auth_req('get', self.url)
     self.assertEqual(rsp.status_code, status.HTTP_200_OK)
     active_flags = json.loads(rsp.content)['active_flags']
     self.assertIn(everyone_flag.name, active_flags)
     self.assertIn(tenant_switch.name, active_flags)
     self.assertNotIn(nontenant_switch.name, active_flags)
コード例 #3
0
ファイル: test_views.py プロジェクト: azizur77/etools
 def test_flag_and_switch_have_same_name(self):
     country = CountryFactory()
     connection.tenant = country
     same_name = 'identical'
     TenantSwitchFactory(countries=[country], name=same_name)
     TenantFlagFactory(everyone=True, name=same_name)
     rsp = self.forced_auth_req('get', self.url)
     self.assertEqual(rsp.status_code, status.HTTP_200_OK)
     active_flags = json.loads(rsp.content)['active_flags']
     self.assertEqual(len(active_flags), 1)
     self.assertIn(same_name, active_flags)
コード例 #4
0
ファイル: test_models.py プロジェクト: azizur77/etools
 def setUpTestData(cls):
     cls.tenant_switch = TenantSwitchFactory(active=True)
     connection.tenant = CountryFactory()