Code Review
/
pti
/
o2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Fix install O2 on subcloud failed
[pti/o2.git]
/
tests
/
unit
/
test_alarm.py
diff --git
a/tests/unit/test_alarm.py
b/tests/unit/test_alarm.py
index
5309eb5
..
1503d09
100644
(file)
--- a/
tests/unit/test_alarm.py
+++ b/
tests/unit/test_alarm.py
@@
-169,10
+169,16
@@
def test_flask_get_one(mock_flask_uow):
assert resp.status_code == 404
assert resp.status_code == 404
-def test_flask_post(mock_flask_uow):
+def test_flask_post(mock_flask_uow
, mappers
):
session, app = mock_flask_uow
apibase = config.get_o2ims_monitoring_api_base() + '/v1'
session, app = mock_flask_uow
apibase = config.get_o2ims_monitoring_api_base() + '/v1'
+ order_by = MagicMock()
+ order_by.count.return_value = 0
+ order_by.limit.return_value.offset.return_value = []
+ session.return_value.query.return_value.filter.return_value.\
+ order_by.return_value = order_by
+
with app.test_client() as client:
session.return_value.execute.return_value = []
with app.test_client() as client:
session.return_value.execute.return_value = []
@@
-180,7
+186,7
@@
def test_flask_post(mock_flask_uow):
resp = client.post(apibase+'/alarmSubscriptions', json={
'callback': sub_callback,
'consumerSubscriptionId': 'consumerSubId1',
resp = client.post(apibase+'/alarmSubscriptions', json={
'callback': sub_callback,
'consumerSubscriptionId': 'consumerSubId1',
- 'filter': '
empty
'
+ 'filter': '
(eq,resourceTypeId,xxx)
'
})
assert resp.status_code == 201
assert 'alarmSubscriptionId' in resp.get_json()
})
assert resp.status_code == 201
assert 'alarmSubscriptionId' in resp.get_json()
@@
-195,7
+201,7
@@
def test_flask_delete(mock_flask_uow):
subscription_id1 = str(uuid.uuid4())
resp = client.delete(apibase+"/alarmSubscriptions/"+subscription_id1)
subscription_id1 = str(uuid.uuid4())
resp = client.delete(apibase+"/alarmSubscriptions/"+subscription_id1)
- assert resp.status_code == 20
4
+ assert resp.status_code == 20
0
def test_flask_not_allowed(mock_flask_uow):
def test_flask_not_allowed(mock_flask_uow):
@@
-308,7
+314,12
@@
def test_probe_new_alarm():
bus = create_alarm_fake_bus(fakeuow)
fakeClient = FakeAlarmClient()
alarmwatcher = AlarmWatcher(fakeClient, bus)
bus = create_alarm_fake_bus(fakeuow)
fakeClient = FakeAlarmClient()
alarmwatcher = AlarmWatcher(fakeClient, bus)
- cmds = alarmwatcher.probe()
+ parent = type('obj', (object,), {
+ 'data': type('obj', (object,), {
+ 'id': 'test_parent_id',
+ 'res_pool_id': 'test_res_pool'
+ })})
+ cmds = alarmwatcher.probe(parent)
assert cmds is not None
assert len(cmds) == 1
assert cmds[0].data.name == "alarm"
assert cmds is not None
assert len(cmds) == 1
assert cmds[0].data.name == "alarm"