def test_detach_external_volume_or_instance(self):
        """ This tests that this function returns False
        if use_external_resource is false.
        """

        ctx = self.mock_relationship_context("test_detach_external_volume_or_instance")
        current_ctx.set(ctx=ctx)
        ctx.source.node.properties["use_external_resource"] = False

        output = ebs._detach_external_volume_or_instance()

        self.assertEqual(False, output)
Example #2
0
    def test_detach_external_volume_or_instance(self):
        """ This tests that this function returns False
        if use_external_resource is false.
        """

        ctx = self.mock_relationship_context(
            'test_detach_external_volume_or_instance')
        current_ctx.set(ctx=ctx)
        ctx.source.node.properties['use_external_resource'] = False

        output = \
            ebs._detach_external_volume_or_instance()

        self.assertEqual(False, output)
    def test_detach_external_volume(self):
        """ Tests that when an address that is in the user's
            EC2 account is provided to the disassociate function
            and use_external_resource is true
            no errors are raised
        """

        ctx = self.mock_relationship_context("test_detach_external_volume")
        current_ctx.set(ctx=ctx)
        volume = self.get_volume()
        instance_id = self.get_instance_id()
        ctx.target.node.properties["use_external_resource"] = False
        ctx.target.node.properties["resource_id"] = volume.id
        ctx.source.node.properties["use_external_resource"] = False
        ctx.source.node.properties["resource_id"] = instance_id
        ctx.source.instance.runtime_properties["aws_resource_id"] = instance_id
        output = ebs._detach_external_volume_or_instance()
        self.assertEqual(False, output)
Example #4
0
    def test_detach_external_volume(self):
        """ Tests that when an address that is in the user's
            EC2 account is provided to the disassociate function
            and use_external_resource is true
            no errors are raised
        """

        ctx = self.mock_relationship_context('test_detach_external_volume')
        current_ctx.set(ctx=ctx)
        volume = self.get_volume()
        instance_id = self.get_instance_id()
        ctx.target.node.properties['use_external_resource'] = False
        ctx.target.node.properties['resource_id'] = volume.id
        ctx.source.node.properties['use_external_resource'] = False
        ctx.source.node.properties['resource_id'] = instance_id
        ctx.source.instance.runtime_properties['aws_resource_id'] = \
            instance_id
        output = \
            ebs._detach_external_volume_or_instance()
        self.assertEqual(False, output)