def test_remove_subscriptions(self): self.gg._gg.delete_subscription_definition = MagicMock( return_value=state['Subscriptions']) self.gg.state = greengo.State(state.copy()) self.gg.remove_subscriptions() self.assertFalse(self.gg.state.get('Subscriptions'), "Subscriptions shall be removed")
def test_remove_resources(self): self.gg._gg.delete_resource_definition = MagicMock( return_value=state['Resources']) self.gg.state = greengo.State(state.copy()) self.gg.remove_resources() self.assertFalse(self.gg.state.get('Resources'), "Resources shall be removed")
def test_create_group_version_fullset(self): self.gg.state = greengo.State(state.copy()) m = MagicMock() self.gg._gg.create_group_version = m self.gg.create_group_version() args, kwargs = m.call_args self.assertEqual(len(kwargs), 5) # TODO: Refine expected kwarg count
def test_create_subscriptions(self): self.gg.state = greengo.State(state.copy()) self.gg.state.pop('Subscriptions') self.gg._gg.create_subscription_definition = MagicMock( return_value=state['Subscriptions']) self.gg._gg.get_subscription_definition_version = MagicMock( return_value=state['Subscriptions']['LatestVersionDetails']) self.gg.create_subscriptions()
def test_create_group_version_subset(self): self.gg.state = greengo.State(state.copy()) self.gg.state.pop('Subscriptions') self.gg.state.pop('FunctionDefinition') m = MagicMock() self.gg._gg.create_group_version = m self.gg.create_group_version() args, kwargs = m.call_args self.assertEqual(len(kwargs), 3) # TODO: Refine expected kwarg count
def load_state(request): # Load test state once per session. global state with open('tests/test_state.json', 'r') as f: state = greengo.State(json.load(f))