Files
deb-python-fuelclient/fuelclient/tests/utils/fake_task.py
Roman Prykhodchenko bddabd470d Return realistic data from mocked library
Base CLI test mocks client library in order to test
command line components indepentently. If not configured
explicitly a mocked library returns mocks that accept
any incomng message without producing an error, even if
in real life scenarions if should be risen.

This patch configured mocked library to return realistic
data and fixes a problem in the code that was missed
because of the above-mentioned misconfiguration.

Closes-bug: #1467510
Change-Id: I065345d59c94e06f9d061c2e9b0b415e45fd62fb
2015-06-23 16:00:05 +02:00

32 lines
1.1 KiB
Python

# -*- coding: utf-8 -*-
#
# Copyright 2015 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
def get_fake_task(task_id=None, status=None, name=None,
cluster=None, result=None, progress=None):
"""Create a fake task
Returns the serialized and parametrized representation of a dumped Fuel
Task. Represents the average amount of data.
"""
return {'status': status or 'running',
'name': name or 'deploy',
'task_id': task_id or 42,
'cluster': cluster or 34,
'result': result or '',
'progress': progress or 50}