def test_attach(self): ctx = self.get_mock_ctx("InternetGateway") self.internet_gateway.resource_id = 'internet gateway' config = {VPC_ID: 'vpc'} iface = MagicMock() iface.attach = self.mock_return(config) internet_gateway.attach(ctx, iface, config) self.assertEqual(self.internet_gateway.resource_id, 'internet gateway')
def test_attach_with_relationships(self): ctx = self.get_mock_ctx("InternetGateway", type_hierarchy=[VPC_TYPE]) config = {INTERNETGATEWAY_ID: 'internet gateway'} self.internet_gateway.resource_id = config[INTERNETGATEWAY_ID] iface = MagicMock() iface.attach = self.mock_return(config) with patch('cloudify_awssdk.common.utils.find_rel_by_node_type'): internet_gateway.attach(ctx, iface, config) self.assertEqual(self.internet_gateway.resource_id, 'internet gateway')