def test_i_have_name_section_configured_type_not_found(self): step = MockedStep() with self.assertRaises(AssertionError) as err: i_have_name_section_configured(step, 'some_name', 'some_invalid_type', 'some_world') self.assertEqual(str(err.exception), 'some_invalid_type configuration type does not exist or not implemented ' 'yet. Use resource(s), provider(s), variable(s) or data(s) instead.')
def test_i_have_name_section_configured(self): i_have_name_section_configured(self.step, 'resource_type', 'resource', self.radish_world) self.assertEqual( self.step.context.stash.resource_list[0], MockedWorldConfigTerraform().terraform_config['resource'] ['resource_type']) i_have_name_section_configured(self.step, 'aws', 'provider', self.radish_world) self.assertEqual( self.step.context.stash, MockedWorldConfigTerraform().terraform_config['provider']['aws']) i_have_name_section_configured(self.step, 'non_existent', 'something_else', self.radish_world) self.assertEqual( self.step.context.stash, MockedWorldConfigTerraform().terraform_config['something_else']) i_have_name_section_configured(self.step, 'AWS S3 Bucket', 'resource', self.radish_world) self.assertEqual( self.step.context.stash.resource_list[0], MockedWorldConfigTerraform().terraform_config['resource'] ['aws_s3_bucket'])
def test_i_have_name_section_configured_provider_found(self): step = MockedStep() world = MockedWorld() name = 'some_provider' type_name = 'providers' self.assertTrue(i_have_name_section_configured(step, name, type_name, world))
def test_i_have_name_section_configured_variable_found(self): step = MockedStep() world = MockedWorld() name = 'some_variable' type_name = 'variables' self.assertTrue(i_have_name_section_configured(step, name, type_name, world))
def test_i_have_name_section_configured_resource_found(self): step = MockedStep() world = MockedWorld() name = 'resource_type_without_tags' type_name = 'resource' self.assertTrue(i_have_name_section_configured(step, name, type_name, world))
def test_i_have_name_section_configured_provider_not_found(self): step = MockedStep() world = MockedWorld() name = 'non_existing_provider' type_name = 'provider' self.assertIsNone(i_have_name_section_configured(step, name, type_name, world)) self.assertEqual(step.state, 'skipped')
def test_i_have_name_section_configured_variable_not_found(self): step = MockedStep() world = MockedWorld() name = 'non_existent_variable' type_name = 'variable' self.assertIsNone(i_have_name_section_configured(step, name, type_name, world)) self.assertEqual(step.state, 'skipped')
def test_i_have_name_section_configured_resource_not_found(self, *args): step = MockedStep() world = MockedWorld() name = 'non_existent_resource_id' type_name = 'resource' self.assertIsNone(i_have_name_section_configured(step, name, type_name, world)) self.assertEqual(step.state, 'skipped')
def test_i_have_name_section_configured_resource_that_supports_tags_not_found(self): step = MockedStep() world = MockedWorld() del world.config.terraform.resources['provider_type_id'] name = 'resource that supports tags' type_name = 'resource' self.assertIsNone(i_have_name_section_configured(step, name, type_name, world)) self.assertEqual(step.state, 'skipped')
def test_i_have_name_section_configured_resource_that_supports_tags_found(self): step = MockedStep() world = MockedWorld() name = 'resource that supports tags' type_name = 'resource' self.assertTrue(i_have_name_section_configured(step, name, type_name, world)) self.assertEqual(step.context.name, name) self.assertEqual(step.context.type, type_name)