| 1 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 2 |
# not use this file except in compliance with the License. You may obtain |
| 3 |
# a copy of the License at |
| 4 |
# |
| 5 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 6 |
# |
| 7 |
# Unless required by applicable law or agreed to in writing, software |
| 8 |
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 9 |
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 10 |
# License for the specific language governing permissions and limitations |
| 11 |
# under the License. |
| 12 |
|
| 13 |
"""API Test Fakes""" |
| 14 |
|
| 15 |
from keystoneauth1 import session |
| 16 |
from requests_mock.contrib import fixture |
| 17 |
|
| 18 |
from osc_lib.test import base |
| 19 |
|
| 20 |
|
| 21 |
RESP_ITEM_1 = { |
| 22 |
'id': '1', |
| 23 |
'name': 'alpha', |
| 24 |
'status': 'UP', |
| 25 |
'props': {'a': 1, 'b': 2}, |
| 26 |
} |
| 27 |
RESP_ITEM_2 = { |
| 28 |
'id': '2', |
| 29 |
'name': 'beta', |
| 30 |
'status': 'DOWN', |
| 31 |
'props': {'a': 2, 'b': 2}, |
| 32 |
} |
| 33 |
RESP_ITEM_3 = { |
| 34 |
'id': '3', |
| 35 |
'name': 'delta', |
| 36 |
'status': 'UP', |
| 37 |
'props': {'a': 3, 'b': 1}, |
| 38 |
} |
| 39 |
|
| 40 |
LIST_RESP = [RESP_ITEM_1, RESP_ITEM_2] |
| 41 |
|
| 42 |
LIST_BODY = { |
| 43 |
'p1': 'xxx', |
| 44 |
'p2': 'yyy', |
| 45 |
} |
| 46 |
|
| 47 |
|
| 48 |
class TestSession(base.TestCase): |
| 49 |
BASE_URL = 'https://api.example.com:1234/test' |
| 50 |
|
| 51 |
def setUp(self): |
| 52 |
super().setUp() |
| 53 |
self.sess = session.Session() |
| 54 |
self.requests_mock = self.useFixture(fixture.Fixture()) |