| |
@@ -1,5 +1,7 @@
|
| |
import json
|
| |
|
| |
+ from unittest import mock
|
| |
+
|
| |
from copr_common.enums import BackendResultEnum, StatusEnum
|
| |
from tests.coprs_test_case import CoprsTestCase, new_app_context
|
| |
from coprs.logic.builds_logic import BuildsLogic
|
| |
@@ -300,25 +302,24 @@
|
| |
{
|
| |
"id": 1,
|
| |
"result": 1,
|
| |
- "message": null,
|
| |
- "ended_on": 1390866440
|
| |
+ "message": null
|
| |
},
|
| |
{
|
| |
"id": 2,
|
| |
"result": 2,
|
| |
- "message": "problem!",
|
| |
- "ended_on": 1390866440
|
| |
+ "message": "problem!"
|
| |
},
|
| |
{
|
| |
"id": 100,
|
| |
"result": 123,
|
| |
- "message": "wheeeee!",
|
| |
- "ended_on": 1390866440
|
| |
+ "message": "wheeeee!"
|
| |
}
|
| |
]
|
| |
}"""
|
| |
|
| |
- def test_update_one_action(self, f_users, f_coprs, f_actions, f_db):
|
| |
+ @mock.patch('coprs.logic.actions_logic.time.time')
|
| |
+ def test_update_one_action(self, mc_time, f_users, f_coprs, f_actions, f_db):
|
| |
+ mc_time.return_value = 1390866440
|
| |
r = self.tc.post("/backend/update/",
|
| |
content_type="application/json",
|
| |
headers=self.auth_header,
|
| |
@@ -332,9 +333,12 @@
|
| |
assert updated.message == "no problem"
|
| |
assert updated.ended_on == 1390866440
|
| |
|
| |
- def test_update_more_existent_and_non_existent_actions(self, f_users,
|
| |
- f_coprs, f_actions,
|
| |
- f_db):
|
| |
+
|
| |
+ @mock.patch('coprs.logic.actions_logic.time.time')
|
| |
+ def test_update_more_existent_and_non_existent_actions(self, mc_time, f_users,
|
| |
+ f_coprs, f_actions,
|
| |
+ f_db):
|
| |
+ mc_time.return_value = 1390866440
|
| |
r = self.tc.post("/backend/update/",
|
| |
content_type="application/json",
|
| |
headers=self.auth_header,
|
| |
It turned out that some tests failed in 'manage.py test', but the
command returned exit status 0. This seems to be the design of click:
https://github.com/pallets/click/issues/747