mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-25 00:33:58 -04:00
Make fixture for getting service with organisation
Saves repeatedly defining the same mock.
This commit is contained in:
@@ -2,7 +2,7 @@ import json
|
||||
import os
|
||||
from contextlib import contextmanager
|
||||
from datetime import date, datetime, timedelta
|
||||
from unittest.mock import Mock
|
||||
from unittest.mock import Mock, PropertyMock
|
||||
from uuid import UUID, uuid4
|
||||
|
||||
import pytest
|
||||
@@ -3138,6 +3138,18 @@ def mock_get_no_organisation_by_domain(mocker):
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
def mock_get_service_organisation(
|
||||
mocker,
|
||||
mock_get_organisation,
|
||||
):
|
||||
return mocker.patch(
|
||||
'app.models.service.Service.organisation_id',
|
||||
new_callable=PropertyMock,
|
||||
return_value=ORGANISATION_ID,
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
def mock_update_service_organisation(mocker):
|
||||
def _update_service_organisation(service_id, organisation_id):
|
||||
|
||||
Reference in New Issue
Block a user