| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
from unittest import mock |
| 16 |
|
| 17 |
from oslotest import base |
| 18 |
from requests_mock.contrib import fixture |
| 19 |
|
| 20 |
|
| 21 |
class BaseClientTest(base.BaseTestCase): |
| 22 |
_client = None |
| 23 |
|
| 24 |
def setUp(self): |
| 25 |
super(BaseClientTest, self).setUp() |
| 26 |
|
| 27 |
self.requests_mock = self.useFixture(fixture.Fixture()) |
| 28 |
|
| 29 |
|
| 30 |
class BaseCommandTest(base.BaseTestCase): |
| 31 |
def setUp(self): |
| 32 |
super(BaseCommandTest, self).setUp() |
| 33 |
|
| 34 |
self.app = mock.Mock() |
| 35 |
self.client = self.app.client_manager.workflow_engine |
| 36 |
|
| 37 |
def call(self, command, app_args=(), prog_name=''): |
| 38 |
cmd = command(self.app, app_args) |
| 39 |
|
| 40 |
parsed_args = cmd.get_parser(prog_name).parse_args(app_args) |
| 41 |
|
| 42 |
return cmd.take_action(parsed_args) |