diff --git a/bc_obps/reporting/tests/api/test_report_version_endpoint.py b/bc_obps/reporting/tests/api/test_report_version_endpoint.py index 6873ac40b4..2f7e91985a 100644 --- a/bc_obps/reporting/tests/api/test_report_version_endpoint.py +++ b/bc_obps/reporting/tests/api/test_report_version_endpoint.py @@ -39,7 +39,8 @@ def test_unauthorized_users_cannot_post_report_version(self): assert response.status_code == 401 def test_authorized_users_can_post_updates_to_report_version(self): - report_version = report_version_baker() + report_version = report_version_baker(report_type="Initial Report") + TestUtils.authorize_current_user_as_operator_user(self, operator=report_version.report.operator) endpoint_under_test = f'/api/reporting/report-version/{report_version.id}/report-operation' @@ -54,19 +55,15 @@ def test_authorized_users_can_post_updates_to_report_version(self): "activities": [], "regulated_products": [], "operation_representative_name": "new operation representative name", - "operation_report_type": "LFO", # This belongs to ReportVersion, not ReportOperation + "operation_report_type": "Annual Report", } - - # Assert changes for ReportOperation fields assert report_version.report_operation.operator_legal_name != data['operator_legal_name'] assert report_version.report_operation.operator_trade_name != data['operator_trade_name'] assert report_version.report_operation.operation_name != data['operation_name'] assert report_version.report_operation.operation_bcghgid != data['operation_bcghgid'] assert report_version.report_operation.bc_obps_regulated_operation_id != data['bc_obps_regulated_operation_id'] assert report_version.report_operation.operation_representative_name != data['operation_representative_name'] - - # Assert change for ReportVersion field - assert report_version.report_type != data['operation_report_type'] # Correctly assert for ReportVersion + assert report_version.report_type != data['operation_report_type'] response = TestUtils.mock_post_with_auth_role( self, 'industry_user', self.content_type, data, endpoint_under_test @@ -74,12 +71,9 @@ def test_authorized_users_can_post_updates_to_report_version(self): assert response.status_code == 201 response_json = response.json() - - # Assert response for ReportOperation fields assert response_json['operator_legal_name'] == data['operator_legal_name'] assert response_json['operator_trade_name'] == data['operator_trade_name'] assert response_json['operation_name'] == data['operation_name'] assert response_json['operation_bcghgid'] == data['operation_bcghgid'] assert response_json['bc_obps_regulated_operation_id'] == data['bc_obps_regulated_operation_id'] assert response_json['operation_representative_name'] == data['operation_representative_name'] - diff --git a/bc_obps/reporting/tests/models/test_report_version.py b/bc_obps/reporting/tests/models/test_report_version.py index e7a0385925..a48ecaab99 100644 --- a/bc_obps/reporting/tests/models/test_report_version.py +++ b/bc_obps/reporting/tests/models/test_report_version.py @@ -11,6 +11,7 @@ def setUpTestData(cls): *TIMESTAMP_COMMON_FIELDS, ("id", "ID", None, None), ("report", "report", None, None), + ("report_type", "report type", None, None), ("is_latest_submitted", "is latest submitted", None, None), ("status", "status", 1000, None), ("facility_reports", "facility report", None, 0),