@staticmethod
    def create_one_flavor(attrs=None):
        """Create a fake flavor.

        :param Dictionary attrs:
            A dictionary with all attributes
        :return:
            A FakeResource object, with id, name, ram, vcpus, properties
        """
        attrs = attrs or {}

        # Set default attributes.
        flavor_info = {
            'id': 'flavor-id-' + uuid.uuid4().hex,
            'name': 'flavor-name-' + uuid.uuid4().hex,
            'ram': 8192,
            'vcpus': 4,
            'disk': 128,
            'swap': '',
            'rxtx_factor': '1.0',
            'OS-FLV-DISABLED:disabled': False,
            'os-flavor-access:is_public': True,
            'OS-FLV-EXT-DATA:ephemeral': 0,
        }

        # Overwrite default attributes.
        flavor_info.update(attrs)

        # Set default methods.
        flavor_methods = {
            'set_keys': None,
            'unset_keys': None,
            'get_keys': {'property': 'value'},
        }

        flavor = fakes.FakeResource(info=copy.deepcopy(flavor_info),
                                    methods=flavor_methods,
                                    loaded=True)

        # Set attributes with special mappings in nova client.
        flavor.disabled = flavor_info['OS-FLV-DISABLED:disabled']
        flavor.is_public = flavor_info['os-flavor-access:is_public']
        flavor.ephemeral = flavor_info['OS-FLV-EXT-DATA:ephemeral']

        return flavor
dataset/ETHPy150Open dtroyer/python-openstackclient/openstackclient/tests/compute/v2/fakes.py/FakeFlavor.create_one_flavor/original