def test_get_organization_invalid_organization(self): """ Unit Test: test_get_organization_invalid_organization """ with self.assertNumQueries(0): with self.assertRaises(exceptions.InvalidOrganizationException): api.get_organization(None) with self.assertNumQueries(0): with self.assertRaises(exceptions.InvalidOrganizationException): api.get_organization(0)
def test_remove_organization_bogus_organization(self): """ Unit Test: test_remove_organization_bogus_organization """ with self.assertNumQueries(3): api.remove_organization(self.test_organization['id']) with self.assertRaises(exceptions.InvalidOrganizationException): api.get_organization(self.test_organization['id']) # Do it again with the valid id to hit the exception workflow with self.assertNumQueries(2): api.remove_organization(self.test_organization['id']) with self.assertRaises(exceptions.InvalidOrganizationException): api.get_organization(self.test_organization['id'])
def test_get_organization(self): """ Unit Test: test_get_organization""" with self.assertNumQueries(1): organization = api.get_organization(self.test_organization['id']) self.assertEqual(organization['name'], self.test_organization['name']) self.assertEqual(organization['description'], self.test_organization['description'])
def test_get_organization(self): """ Unit Test: test_get_organization""" with self.assertNumQueries(1): organization = api.get_organization(self.test_organization["id"]) self.assertEqual(organization["name"], self.test_organization["name"]) self.assertEqual(organization["description"], self.test_organization["description"])
def get_organization(organization_id): """ Client API operation adapter/wrapper """ if not organizations_enabled(): return [] from organizations import api as organizations_api return organizations_api.get_organization(organization_id)
def get_organization(organization_id): """ Client API operation adapter/wrapper """ if not settings.FEATURES.get('ORGANIZATIONS_APP', False): return [] from organizations import api as organizations_api return organizations_api.get_organization(organization_id)
def test_add_organization_inactive_to_active(self): """ Unit Test: test_add_organization_inactive_to_active""" organization_data = { 'name': 'local_organizationßßß', 'description': 'Local Organization Descriptionßßß' } organization = api.add_organization(organization_data) self.assertGreater(organization['id'], 0) api.remove_organization(organization['id']) with self.assertNumQueries(5): organization = api.add_organization(organization_data) # Assert that the organization is active by making sure we can load it. loaded_organization = api.get_organization(organization['id']) self.assertEqual(loaded_organization['name'], organization_data['name'])
def test_remove_organization(self): """ Unit Test: test_remove_organization """ with self.assertNumQueries(3): api.remove_organization(self.test_organization['id']) with self.assertRaises(exceptions.InvalidOrganizationException): api.get_organization(self.test_organization['id'])