def test_create_flavor(self):
        tenant_id = uuidutils.generate_uuid()
        # Use service_type FLAVORS since plugin must be loaded to validate
        data = {'flavor': {'name': 'GOLD',
                           'service_type': constants.FLAVORS,
                           'description': 'the best flavor',
                           'tenant_id': tenant_id,
                           'enabled': True}}

        expected = copy.deepcopy(data)
        expected['flavor']['service_profiles'] = []

        instance = self.plugin.return_value
        instance.create_flavor.return_value = expected['flavor']
        res = self.api.post(_get_path('flavors', fmt=self.fmt),
                            self.serialize(data),
                            content_type=self.fmt % 'application/%s')

        instance.create_flavor.assert_called_with(mock.ANY,
                                                  flavor=expected)
        res = self.deserialize(res)
        self.assertIn('flavor', res)
        self.assertEqual(expected, res)
dataset/ETHPy150Open openstack/neutron/neutron/tests/unit/extensions/test_flavors.py/FlavorExtensionTestCase.test_create_flavor/swapped operands of `%`