Skip to content

Commit

Permalink
Added test where respondent data has no value at all
Browse files Browse the repository at this point in the history
  • Loading branch information
lambeb committed Nov 11, 2024
1 parent 911534c commit 905c4c8
Showing 1 changed file with 38 additions and 1 deletion.
39 changes: 38 additions & 1 deletion tests/services/test_mi_hub_reports_service.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from unittest.mock import create_autospec

import pytest
from py._code.code import ExceptionInfo

from functions.google_storage_functions import GoogleStorage
from models.mi_hub_call_history_model import MiHubCallHistory
Expand Down Expand Up @@ -184,4 +185,40 @@ def test_deliver_mi_hub_reports_with_some_data_empty_returns_expected_string(
)

# assert
assert result == f"Done - {QUESTIONNAIRE_NAME}"
assert result == f"Done - {QUESTIONNAIRE_NAME}"



@pytest.fixture
def mock_mi_hub_respondent_data_missing():
return [
MiHubRespondentData(
serial_number=None,
outcome_code=None,
date_completed=None,
interviewer=None,
mode=None,
postcode=None,
gender=None,
date_of_birth=None,
age=None,
),
]


def test_deliver_mi_hub_reports_with_no_respondent_data(
mock_mi_hub_call_history, mock_mi_hub_respondent_data_missing
):
# arrange
mock_google_storage = create_autospec(GoogleStorage)

# act
result = DeliverMiHubReportsService.upload_mi_hub_reports_to_gcp(
questionnaire_name=QUESTIONNAIRE_NAME,
mi_hub_call_history=mock_mi_hub_call_history,
mi_hub_respondent_data=mock_mi_hub_respondent_data_missing,
google_storage=mock_google_storage,
)

# assert
assert result == f"Done - {QUESTIONNAIRE_NAME}"

0 comments on commit 905c4c8

Please sign in to comment.