def test_delete_external_securitygroup_external(self):

        ctx = self.mock_cloudify_context("test_delete_external_securitygroup_external")
        current_ctx.set(ctx=ctx)

        ctx.node.properties["use_external_resource"] = True
        ctx.instance.runtime_properties[EXTERNAL_RESOURCE_ID] = "sg-blahblah"

        output = securitygroup._delete_external_securitygroup()
        self.assertEqual(True, output)
        self.assertNotIn(EXTERNAL_RESOURCE_ID, ctx.instance.runtime_properties)
    def test_delete_external_securitygroup_not_external(self):
        """ This checks that _delete_external_securitygroup
        returns false when use_external_resource is false.
        """

        test_properties = self.get_mock_properties()
        ctx = self.security_group_mock("test_delete_external_securitygroup_not_external", test_properties)
        current_ctx.set(ctx=ctx)

        ctx.node.properties["use_external_resource"] = False

        output = securitygroup._delete_external_securitygroup()
        self.assertEqual(False, output)