def setUp(self): """ Create a mock group """ self.tenant_id = '11111' self.group_id = '1' self.mock_log = mock.MagicMock() self.collection = mock.MagicMock(spec=[], data={self.tenant_id: {}}) self.config = {'name': 'aname', 'cooldown': 0, 'minEntities': 0} # this is the config with all the default vals self.output_config = { 'name': 'aname', 'cooldown': 0, 'minEntities': 0, 'maxEntities': None, 'metadata': {} } self.launch_config = { "type": "launch_server", "args": { "server": { "these are": "some args" } } } self.policies = group_examples.policy()[:1] self.group = MockScalingGroup( self.mock_log, self.tenant_id, self.group_id, self.collection, { 'config': self.config, 'launch': self.launch_config, 'policies': self.policies }) self.collection.data[self.tenant_id]['1'] = self.group
def test_list_empty_policies(self): """ If there are no policies, list policies conforms to the schema and also is an empty dictionary """ self.group = MockScalingGroup(self.mock_log, self.tenant_id, '1', self.collection, { 'config': self.config, 'launch': self.launch_config, 'policies': None }) self.assertEqual(self.validate_list_policies_return_value(), {})