@mock.patch("%s.flavors.osclients.Clients" % CTX)
    def test_setup(self, mock_clients):
        # Setup and mock
        mock_create = mock_clients().nova().flavors.create
        mock_create().to_dict.return_value = {"flavor_key": "flavor_value"}

        # Run
        flavors_ctx = flavors.FlavorsGenerator(self.context)
        flavors_ctx.setup()

        # Assertions
        self.assertEqual(flavors_ctx.context["flavors"],
                         {"flavor_name": {"flavor_key": "flavor_value"}})

        mock_clients.assert_called_with(self.context["admin"]["credential"])

        mock_create.assert_called_with(
            name="flavor_name", ram=2048, vcpus=3,
            disk=10, ephemeral=3, swap=5)
        mock_create().set_keys.assert_called_with({"key": "value"})
        mock_create().to_dict.assert_called_with()
dataset/ETHPy150Open openstack/rally/tests/unit/plugins/openstack/context/nova/test_flavors.py/FlavorsGeneratorTestCase.test_setup/original