def test_release_external_elasticip_external(self):

        ctx = self.mock_cloudify_context('test_release_external_elasticip')
        current_ctx.set(ctx=ctx)
        ctx.node.properties['use_external_resource'] = True
        ctx.instance.runtime_properties[EXTERNAL_RESOURCE_ID] = \
            '127.0.0.1'

        output = \
            elasticip._release_external_elasticip()

        self.assertEqual(True, output)
        self.assertNotIn(EXTERNAL_RESOURCE_ID, ctx.instance.runtime_properties)
    def test_release_external_elasticip(self):
        """ This tests that this function returns False
        if use_external_resource is false.
        """

        ctx = self.mock_ctx(
            'test_release_external_elasticip')
        current_ctx.set(ctx=ctx)
        ctx.node.properties['use_external_resource'] = False

        output = \
            elasticip._release_external_elasticip()

        self.assertEqual(False, output)
    def test_release_external_elasticip_external(self):

        ctx = self.mock_cloudify_context(
            'test_release_external_elasticip')
        current_ctx.set(ctx=ctx)
        ctx.node.properties['use_external_resource'] = True
        ctx.instance.runtime_properties[EXTERNAL_RESOURCE_ID] = \
            '127.0.0.1'

        output = \
            elasticip._release_external_elasticip()

        self.assertEqual(True, output)
        self.assertNotIn(
            EXTERNAL_RESOURCE_ID,
            ctx.instance.runtime_properties)