SIENTIAPDE-1148
Update sonar-project.properties to exclude worker.py from coverage, enhance error handling in worker.py, and add new tests for error scenarios in test_redis.py and test_mongo.py.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from datetime import datetime
|
||||
from unittest.mock import ANY, MagicMock, patch
|
||||
from unittest.mock import ANY, MagicMock, call, patch
|
||||
from pytest import fixture, mark
|
||||
from sientia_do.notifications.models import NotificationLevel
|
||||
from scouter.activities.mongodb import MongoDB, clear_mongo_id
|
||||
@@ -12,12 +12,22 @@ def test_clear_mongo_id():
|
||||
{'_id': '2', 'name': [{
|
||||
'_id': '3',
|
||||
'name': 'test3'
|
||||
}]}
|
||||
}]},
|
||||
{'_id': '4', 'name': {
|
||||
'_id': '5',
|
||||
'name': 'test2'
|
||||
}},
|
||||
[{'_id': '6', 'name': 'test2'}]
|
||||
]
|
||||
|
||||
result = clear_mongo_id(data)
|
||||
|
||||
assert result == [{'name': 'test1'}, {'name': [{'name': 'test3'}]}]
|
||||
assert result == [
|
||||
{'name': 'test1'},
|
||||
{'name': [{'name': 'test3'}]},
|
||||
{'name': {'name': 'test2'}},
|
||||
[{'name': 'test2'}]
|
||||
]
|
||||
|
||||
|
||||
@patch('scouter.activities.mongodb.MongoClient')
|
||||
|
||||
Reference in New Issue
Block a user