Skip to content

Commit d0e97a5

Browse files
committed
test: updated reporting_year baker to limit years to 1899-9999
1 parent 524ee5d commit d0e97a5

3 files changed

Lines changed: 16 additions & 4 deletions

File tree

bc_obps/compliance/tests/api/_compliance_report_versions/_compliance_report_version_id/test_operation.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ def test_successful_report_operation_retrieval(self):
2828
# Act
2929
# Mock the authorization and perform the request
3030
TestUtils.authorize_current_user_as_operator_user(self, operator=approved_user_operator.operator)
31+
TestUtils.generate_operation_operator_timeline(
32+
operator=test_data.compliance_report_version.compliance_report.report.operator,
33+
operations=[test_data.compliance_report_version.compliance_report.report.operation],
34+
)
3135
response = TestUtils.mock_get_with_auth_role(
3236
self,
3337
"industry_user",

bc_obps/registration/tests/utils/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def generate_operation_operator_timeline(operator: Operator, operations: list[Op
5757
operator=operator,
5858
operation=op,
5959
start_date='1899-01-01',
60-
end_date='2099-12-31',
60+
end_date='9999-12-31',
6161
)
6262

6363
def authorize_current_user_as_operator_user(self, operator):

bc_obps/reporting/tests/utils/baker_recipes.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,22 @@ def json_seq(
8080
yield {json_key: f"{json_value} {next(generator)}"}
8181

8282

83-
reporting_year = Recipe(ReportingYear)
84-
reporting_year_2025 = ReportingYear.objects.get(reporting_year=2025)
83+
def reporting_year_seq(
84+
seq_value: Any = 2050,
85+
**seq_args,
86+
):
87+
generator = seq(seq_value, **seq_args)
88+
while True:
89+
yield next(generator)
90+
91+
92+
reporting_year = Recipe(ReportingYear, reporting_year=reporting_year_seq())
8593

8694
report = Recipe(
8795
Report,
8896
operator=foreign_key(operator),
8997
operation=foreign_key(operation),
90-
reporting_year=reporting_year_2025,
98+
reporting_year=foreign_key(reporting_year),
9199
)
92100

93101
report_version = Recipe(ReportVersion, report=foreign_key(report))

0 commit comments

Comments
 (0)