Skip to content

Commit

Permalink
Improved fixture
Browse files Browse the repository at this point in the history
Signed-off-by: ammar <[email protected]>
  • Loading branch information
ammar92 committed Oct 25, 2023
1 parent 90dfdd3 commit ca8659a
Showing 1 changed file with 31 additions and 28 deletions.
59 changes: 31 additions & 28 deletions rocky/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import binascii
import io
import json
import logging
from os import urandom
Expand Down Expand Up @@ -527,37 +528,39 @@ def mock_mixins_katalogus(mocker):
def mock_scheduler_client_task_list(mocker):
mock_scheduler_client_session = mocker.patch("rocky.scheduler.client.session")
response = Response()
response._content = json.dumps(
{
"count": 1,
"next": "http://scheduler:8000/tasks?scheduler_id=boefje-test&type=boefje&plugin_id=test_plugin&limit=10&offset=10",
"previous": None,
"results": [
{
"id": "2e757dd3-66c7-46b8-9987-7cd18252cc6d",
"scheduler_id": "boefje-test",
"type": "boefje",
"p_item": {
response.raw = io.BytesIO(
json.dumps(
{
"count": 1,
"next": "http://scheduler:8000/tasks?scheduler_id=boefje-test&type=boefje&plugin_id=test_plugin&limit=10&offset=10",
"previous": None,
"results": [
{
"id": "2e757dd3-66c7-46b8-9987-7cd18252cc6d",
"scheduler_id": "boefje-test",
"hash": "416aa907e0b2a16c1b324f7d3261c5a4",
"priority": 631,
"data": {
"id": "2e757dd366c746b899877cd18252cc6d",
"boefje": {"id": "test-plugin", "version": None},
"input_ooi": "Hostname|internet|example.com",
"organization": "test",
"dispatches": [],
"type": "boefje",
"p_item": {
"id": "2e757dd3-66c7-46b8-9987-7cd18252cc6d",
"scheduler_id": "boefje-test",
"hash": "416aa907e0b2a16c1b324f7d3261c5a4",
"priority": 631,
"data": {
"id": "2e757dd366c746b899877cd18252cc6d",
"boefje": {"id": "test-plugin", "version": None},
"input_ooi": "Hostname|internet|example.com",
"organization": "test",
"dispatches": [],
},
"created_at": "2023-05-09T09:37:20.899668+00:00",
"modified_at": "2023-05-09T09:37:20.899675+00:00",
},
"created_at": "2023-05-09T09:37:20.899668+00:00",
"modified_at": "2023-05-09T09:37:20.899675+00:00",
},
"status": "completed",
"created_at": "2023-05-09T09:37:20.909069+00:00",
"modified_at": "2023-05-09T09:37:20.909071+00:00",
}
],
}
"status": "completed",
"created_at": "2023-05-09T09:37:20.909069+00:00",
"modified_at": "2023-05-09T09:37:20.909071+00:00",
}
],
}
).encode()
)

mock_scheduler_client_session.get.return_value = response
Expand Down

0 comments on commit ca8659a

Please sign in to comment.