@mock.patch("%s.flavors.osclients.Clients" % CTX)
    def test_cleanup(self, mock_clients):
        # Setup and mock
        real_context = {
            "flavors": {
                "flavor_name": {
                    "flavor_name": "flavor_name",
                    "id": "flavor_name"
                }
            },
            "admin": {
                "credential": mock.MagicMock()
            },
            "task": mock.MagicMock(),
        }

        # Run
        flavors_ctx = flavors.FlavorsGenerator(real_context)
        flavors_ctx.cleanup()

        # Assertions
        mock_clients.assert_called_with(real_context["admin"]["credential"])

        mock_flavors_delete = mock_clients().nova().flavors.delete
        mock_flavors_delete.assert_called_with("flavor_name")
dataset/ETHPy150Open openstack/rally/tests/unit/plugins/openstack/context/nova/test_flavors.py/FlavorsGeneratorTestCase.test_cleanup/original