From 36ac89efee4359af1ce1fd9c9d38eaa806c91efc Mon Sep 17 00:00:00 2001 From: "Stephen A. Fuqua" Date: Wed, 22 Feb 2023 12:58:16 -0600 Subject: [PATCH 01/12] Update locust --- src/edfi-performance-test/poetry.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/edfi-performance-test/poetry.lock b/src/edfi-performance-test/poetry.lock index e3d4be37..a8cc3bb6 100644 --- a/src/edfi-performance-test/poetry.lock +++ b/src/edfi-performance-test/poetry.lock @@ -350,7 +350,7 @@ format-nongpl = ["fqdn", "idna", "isoduration", "jsonpointer (>1.13)", "rfc3339- [[package]] name = "locust" -version = "2.13.0" +version = "2.14.2" description = "Developer friendly load testing framework" category = "main" optional = false @@ -1322,8 +1322,8 @@ jsonschema = [ {file = "jsonschema-4.16.0.tar.gz", hash = "sha256:165059f076eff6971bae5b742fc029a7b4ef3f9bcf04c14e4776a7605de14b23"}, ] locust = [ - {file = "locust-2.13.0-py3-none-any.whl", hash = "sha256:d747fb1be59d9e3f19e11fb90b8a50ad92b9615243ead67fc14e1e7421e5794e"}, - {file = "locust-2.13.0.tar.gz", hash = "sha256:f603752ab9d4f7d6034c5896c71e6069be49060a5868d6eb4d6c7d32b1c031ae"}, + {file = "locust-2.14.2-py3-none-any.whl", hash = "sha256:058a184438498787c74accf9cfdb32b8db9ce9a1b96894eb045ba2158ce1a62f"}, + {file = "locust-2.14.2.tar.gz", hash = "sha256:cc555d80c92dfbbfc99ab87cec1b454108aa1d2e6e12c4e37fa755a36ad8b9a0"}, ] markupsafe = [ {file = "MarkupSafe-2.1.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:86b1f75c4e7c2ac2ccdaec2b9022845dbb81880ca318bb7a0a01fbf7813e3812"}, From 8b012f6e1d240e9a632259dd0045bc211b870e7f Mon Sep 17 00:00:00 2001 From: "Stephen A. Fuqua" Date: Wed, 22 Feb 2023 12:58:36 -0600 Subject: [PATCH 02/12] Remove unused kwargs --- .../edfi_performance_test/api/client/ed_fi_api_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/ed_fi_api_client.py b/src/edfi-performance-test/edfi_performance_test/api/client/ed_fi_api_client.py index 794dca46..e78b4d57 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/ed_fi_api_client.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/ed_fi_api_client.py @@ -246,7 +246,7 @@ def create_using_dependencies(self, dependency_reference=None, **kwargs): "attributes": resource_attrs, } - def delete_with_dependencies(self, reference, **kwargs): + def delete_with_dependencies(self, reference): """ Atomically delete an instance of this resource along with all dependencies. The `reference` parameter will contain the necessary From 122ce9adcd8b78d199e3238d565b5ccb2e5edfdb Mon Sep 17 00:00:00 2001 From: "Stephen A. Fuqua" Date: Wed, 22 Feb 2023 13:03:50 -0600 Subject: [PATCH 03/12] This has been wrong since at least DS 3.2.0 --- .../factories/resources/community.py | 4 ++-- .../factories/resources/education.py | 8 ++++---- .../edfi_performance_test/factories/resources/school.py | 2 +- .../edfi_performance_test/tasks/volume/school.py | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/edfi-performance-test/edfi_performance_test/factories/resources/community.py b/src/edfi-performance-test/edfi_performance_test/factories/resources/community.py index cb3ed889..88199a46 100644 --- a/src/edfi-performance-test/edfi_performance_test/factories/resources/community.py +++ b/src/edfi-performance-test/edfi_performance_test/factories/resources/community.py @@ -28,7 +28,7 @@ class CommunityOrganizationFactory(APIFactory): ] ) categories = ListOfDescriptors("EducationOrganizationCategory", ["School"]) - educationOrganizationCodes = factory.LazyAttribute( + identificationCodes = factory.LazyAttribute( lambda o: build_descriptor_dicts( "EducationOrganizationIdentificationSystem", [("Other", {"identificationCode": o.communityOrganizationId})], @@ -53,7 +53,7 @@ class CommunityProviderFactory(APIFactory): ] ) categories = ListOfDescriptors("EducationOrganizationCategory", ["School"]) - educationOrganizationCodes = factory.LazyAttribute( + identificationCodes = factory.LazyAttribute( lambda o: build_descriptor_dicts( "EducationOrganizationIdentificationSystem", [("Other", {"identificationCode": o.communityProviderId})], diff --git a/src/edfi-performance-test/edfi_performance_test/factories/resources/education.py b/src/edfi-performance-test/edfi_performance_test/factories/resources/education.py index f2a52813..3dd7fab0 100644 --- a/src/edfi-performance-test/edfi_performance_test/factories/resources/education.py +++ b/src/edfi-performance-test/edfi_performance_test/factories/resources/education.py @@ -31,7 +31,7 @@ class EducationServiceCenterFactory(APIFactory): categories = ListOfDescriptors( "EducationOrganizationCategory", ["Education Service Center"] ) - educationOrganizationCodes = factory.LazyAttribute( + identificationCodes = factory.LazyAttribute( lambda o: build_descriptor_dicts( "EducationOrganizationIdentificationSystem", [("SEA", {"identificationCode": o.educationServiceCenterId})], @@ -53,7 +53,7 @@ class LocalEducationAgencyFactory(APIFactory): localEducationAgencyCategoryDescriptor = build_descriptor( "LocalEducationAgencyCategory", "Independent" ) - educationOrganizationCodes = factory.LazyAttribute( + identificationCodes = factory.LazyAttribute( lambda o: build_descriptor_dicts( "EducationOrganizationIdentificationSystem", [("SEA", {"identificationCode": o.localEducationAgencyId})], @@ -95,7 +95,7 @@ class EducationOrganizationNetworkFactory(APIFactory): ] ) categories = ListOfDescriptors("EducationOrganizationCategory", ["School"]) - educationOrganizationCodes = factory.LazyAttribute( + identificationCodes = factory.LazyAttribute( lambda o: build_descriptor_dicts( "EducationOrganizationIdentificationSystem", [("SEA", {"identificationCode": o.educationOrganizationNetworkId})], @@ -142,7 +142,7 @@ class StateEducationAgencyFactory(APIFactory): categories = ListOfDescriptors( "EducationOrganizationCategory", ["Local Education Agency"] ) - educationOrganizationCodes = factory.LazyAttribute( + identificationCodes = factory.LazyAttribute( lambda o: build_descriptor_dicts( "EducationOrganizationIdentificationSystem", [("SEA", {"identificationCode": o.stateEducationAgencyId})], diff --git a/src/edfi-performance-test/edfi_performance_test/factories/resources/school.py b/src/edfi-performance-test/edfi_performance_test/factories/resources/school.py index 3feb80ea..53f40927 100644 --- a/src/edfi-performance-test/edfi_performance_test/factories/resources/school.py +++ b/src/edfi-performance-test/edfi_performance_test/factories/resources/school.py @@ -32,7 +32,7 @@ class SchoolFactory(APIFactory): educationOrganizationCategories = ListOfDescriptors( "EducationOrganizationCategory", ["School"] ) - educationOrganizationCodes = factory.LazyAttribute( + identificationCodes = factory.LazyAttribute( lambda o: build_descriptor_dicts( "EducationOrganizationIdentificationSystem", [("SEA", {"identificationCode": str(o.schoolId)})], diff --git a/src/edfi-performance-test/edfi_performance_test/tasks/volume/school.py b/src/edfi-performance-test/edfi_performance_test/tasks/volume/school.py index 07c60c48..918b2b7b 100644 --- a/src/edfi-performance-test/edfi_performance_test/tasks/volume/school.py +++ b/src/edfi-performance-test/edfi_performance_test/tasks/volume/school.py @@ -28,7 +28,7 @@ def run_school_scenarios(self): "InstitutionTelephoneNumberType", [("Main", {"telephoneNumber": "(950) 325-9465"})], ), - educationOrganizationCodes=build_descriptor_dicts( + identificationCodes=build_descriptor_dicts( "EducationOrganizationIdentificationSystem", [("SEA", {"identificationCode": "255901444"})], ), From 338a68ba3942d2a74a15159ed5fff5c0e085fedc Mon Sep 17 00:00:00 2001 From: "Stephen A. Fuqua" Date: Thu, 23 Feb 2023 12:43:06 -0600 Subject: [PATCH 04/12] Location header handling that works for Meadowlark --- .../api/client/ed_fi_api_client.py | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/ed_fi_api_client.py b/src/edfi-performance-test/edfi_performance_test/api/client/ed_fi_api_client.py index e78b4d57..96609540 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/ed_fi_api_client.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/ed_fi_api_client.py @@ -7,7 +7,7 @@ import json import logging import re -from typing import Any, Dict +from typing import Any, Dict, Optional import urllib3 @@ -118,6 +118,17 @@ def get_item(self, resource_id): self.log_response(response) return json.loads(response.text) + def _get_resource_id_from_location(self, headers: dict) -> Optional[str]: + header = "" + if "Location" in headers: + header = "Location" + elif "location" in headers: + header = "location" + else: + return None + + return headers[header].split("/")[-1].strip() + def create(self, unique_id_field=None, name=None, **factory_kwargs): # Pass in a `unique_id_field` name (e.g. 'schoolId') to have that # attribute returned alongside the resource_id. Useful if you need @@ -146,7 +157,8 @@ def create(self, unique_id_field=None, name=None, **factory_kwargs): return None, None return None self.log_response(response) - resource_id = response.headers["Location"].split("/")[-1].strip() + + resource_id = self._get_resource_id_from_location(response.headers) if unique_id is not None: return resource_id, unique_id return resource_id @@ -164,8 +176,14 @@ def update(self, resource_id, **update_kwargs): if self.is_not_expected_result(response, [200, 204]): return self.log_response(response) - new_id = response.headers["Location"].split("/")[-1].strip() - assert new_id == resource_id + + new_id = self._get_resource_id_from_location(response.headers) + + # The ODS/API returns a Location header on PUT requests, but this is not a required feature + # of an Ed-Fi API. Therefore only apply this test if the location header was found + if new_id is not None: + assert new_id == resource_id + return resource_id def delete_item(self, resource_id): From 4050060f198bf01d41571e1fc8d71928d92333d5 Mon Sep 17 00:00:00 2001 From: "Stephen A. Fuqua" Date: Thu, 23 Feb 2023 16:18:39 -0600 Subject: [PATCH 05/12] Install pytest-describe --- src/edfi-performance-test/poetry.lock | 2 +- src/edfi-performance-test/pyproject.toml | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/edfi-performance-test/poetry.lock b/src/edfi-performance-test/poetry.lock index a8cc3bb6..be8a729f 100644 --- a/src/edfi-performance-test/poetry.lock +++ b/src/edfi-performance-test/poetry.lock @@ -843,7 +843,7 @@ testing = ["coverage (>=5.0.3)", "zope.event", "zope.testing"] [metadata] lock-version = "1.1" python-versions = "^3.9" -content-hash = "1d26e797355884498120da3c2410acec1d6950113c2217b05e72a75bb46b478e" +content-hash = "b45045c65d920897790ac73eac17c03cb9489917c9a143179868468363ff225c" [metadata.files] attrs = [ diff --git a/src/edfi-performance-test/pyproject.toml b/src/edfi-performance-test/pyproject.toml index 5e79e565..63ae8560 100644 --- a/src/edfi-performance-test/pyproject.toml +++ b/src/edfi-performance-test/pyproject.toml @@ -29,6 +29,9 @@ types-urllib3 = "^1.26.15" types-requests = "^2.28.0" +[tool.poetry.group.dev.dependencies] +pytest-describe = "^2.0.1" + [build-system] requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" From 4d62277e83533d8dbbddd7441fb1d273ee3f0a0d Mon Sep 17 00:00:00 2001 From: "Stephen A. Fuqua" Date: Thu, 23 Feb 2023 16:19:11 -0600 Subject: [PATCH 06/12] Rewrite using pytest-describe --- .../tests/factories/__init__.py | 5 +++ .../tests/factories/test_utils.py | 32 +++++++++---------- 2 files changed, 21 insertions(+), 16 deletions(-) create mode 100644 src/edfi-performance-test/tests/factories/__init__.py diff --git a/src/edfi-performance-test/tests/factories/__init__.py b/src/edfi-performance-test/tests/factories/__init__.py new file mode 100644 index 00000000..1a175fe6 --- /dev/null +++ b/src/edfi-performance-test/tests/factories/__init__.py @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 +# Licensed to the Ed-Fi Alliance under one or more agreements. +# The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0. +# See the LICENSE and NOTICES files in the project root for more information. + diff --git a/src/edfi-performance-test/tests/factories/test_utils.py b/src/edfi-performance-test/tests/factories/test_utils.py index 8e386ce7..de2b4d32 100644 --- a/src/edfi-performance-test/tests/factories/test_utils.py +++ b/src/edfi-performance-test/tests/factories/test_utils.py @@ -8,24 +8,24 @@ from edfi_performance_test.factories.utils import formatted_date -class Test_utils(object): - def test_given_no_year_when_formatting_date_then_use_current_year(self): +def describe_when_formatting_a_date() -> None: + def describe_given_no_year_provided() -> None: + def it_formats_using_current_year() -> None: + month = 12 + day = 1 + expected = str(date.today().year) + "-12-01" - month = 12 - day = 1 - expected = str(date.today().year) + "-12-01" + actual = formatted_date(month, day) - actual = formatted_date(month, day) + assert actual == expected - assert actual == expected + def describe_given_year_is_provided() -> None: + def it_formats_using_the_given_year() -> None: + year = 1999 + month = 12 + day = 1 + expected = "1999-12-01" - def test_given_year_is_supplied_when_formatting_date_then_use_supplied_year(self): + actual = formatted_date(month, day, year) - year = 1999 - month = 12 - day = 1 - expected = "1999-12-01" - - actual = formatted_date(month, day, year) - - assert actual == expected + assert actual == expected From 94e671a788b13a6dc98241887c638a8bc330b01a Mon Sep 17 00:00:00 2001 From: "Stephen A. Fuqua" Date: Thu, 23 Feb 2023 16:19:44 -0600 Subject: [PATCH 07/12] Test for building descriptors Modify descriptor to be capitalized --- .../factories/descriptors/utils.py | 14 ++--- .../tests/factories/descriptors/__init__.py | 5 ++ .../tests/factories/descriptors/test_utils.py | 58 +++++++++++++++++++ 3 files changed, 70 insertions(+), 7 deletions(-) create mode 100644 src/edfi-performance-test/tests/factories/descriptors/__init__.py create mode 100644 src/edfi-performance-test/tests/factories/descriptors/test_utils.py diff --git a/src/edfi-performance-test/edfi_performance_test/factories/descriptors/utils.py b/src/edfi-performance-test/edfi_performance_test/factories/descriptors/utils.py index 5e0b9c5a..b403c4bb 100644 --- a/src/edfi-performance-test/edfi_performance_test/factories/descriptors/utils.py +++ b/src/edfi-performance-test/edfi_performance_test/factories/descriptors/utils.py @@ -3,6 +3,7 @@ # The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0. # See the LICENSE and NOTICES files in the project root for more information. +from typing import Any, Dict, List, Tuple, Union import factory @@ -24,14 +25,13 @@ def _descriptor_type_to_dict_key(descriptor_type): return "{}{}".format(dt[0].lower(), dt[1:]) -def _descriptor_type_to_endpoint(descriptor_type): - return "{}s".format(_descriptor_type_to_dict_key(descriptor_type)) - - def build_descriptor(descriptor_type, value): - _namespace = "uri://ed-fi.org/" descriptor_type = _normalize_descriptor_type(descriptor_type) - return "{}{}#{}".format(_namespace, descriptor_type, value) + + # force first letter to be capitalized + descriptor_type = descriptor_type[:1].capitalize() + descriptor_type[1:] + + return f"{'uri://ed-fi.org/'}{descriptor_type}#{value}" def _build_descriptor_dicts(descriptor_type, values): @@ -48,7 +48,7 @@ def _build_descriptor_dicts(descriptor_type, values): yield defaults -def build_descriptor_dicts(descriptor_type, values): +def build_descriptor_dicts(descriptor_type: str, values: List[Union[str, Tuple[str, Dict[str, Union[str, Any]]]]]) -> List[Dict[str, str]]: """ A common pattern in Ed-Fi resources is to have a list of dicts of descriptors, something like diff --git a/src/edfi-performance-test/tests/factories/descriptors/__init__.py b/src/edfi-performance-test/tests/factories/descriptors/__init__.py new file mode 100644 index 00000000..1a175fe6 --- /dev/null +++ b/src/edfi-performance-test/tests/factories/descriptors/__init__.py @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 +# Licensed to the Ed-Fi Alliance under one or more agreements. +# The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0. +# See the LICENSE and NOTICES files in the project root for more information. + diff --git a/src/edfi-performance-test/tests/factories/descriptors/test_utils.py b/src/edfi-performance-test/tests/factories/descriptors/test_utils.py new file mode 100644 index 00000000..0dd8c68c --- /dev/null +++ b/src/edfi-performance-test/tests/factories/descriptors/test_utils.py @@ -0,0 +1,58 @@ +# SPDX-License-Identifier: Apache-2.0 +# Licensed to the Ed-Fi Alliance under one or more agreements. +# The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0. +# See the LICENSE and NOTICES files in the project root for more information. + +from typing import Dict, List +import pytest + +from edfi_performance_test.factories.descriptors.utils import build_descriptor_dicts, build_descriptor + + +def describe_when_building_a_descriptor() -> None: + @pytest.mark.parametrize("input, expected", [ + ("Title", "uri://ed-fi.org/TitleDescriptor#value"), + ("title", "uri://ed-fi.org/TitleDescriptor#value"), + ("titledescriptor", "uri://ed-fi.org/TitledescriptorDescriptor#value"), + ("title_descriptor", "uri://ed-fi.org/TitleDescriptor#value"), + ]) + def it_formats_the_descriptor_string_correctly(input: str, expected: str) -> None: + actual = build_descriptor(input, "value") + + assert actual == expected + + +def describe_when_building_a_descriptor_dictionary() -> None: + def describe_given_two_grade_levels() -> None: + @pytest.fixture + def result() -> List[str]: + result = build_descriptor_dicts( + "GradeLevel", ["Ninth grade", "Tenth grade"] + ) + + descriptors = [i['gradeLevelDescriptor'] for i in result] + assert len(descriptors) == 2 + + return descriptors + + @pytest.mark.parametrize("expected", [("uri://ed-fi.org/GradeLevelDescriptor#Ninth grade"), ("uri://ed-fi.org/GradeLevelDescriptor#Tenth grade")]) + def it_includes_all_grades(result, expected) -> None: + assert expected in result + + def describe_given_a_telephone_number() -> None: + @pytest.fixture + def result() -> Dict[str, str]: + result = build_descriptor_dicts( + "InstitutionTelephoneNumberType", [("Main", {"telephoneNumber": "(950) 325-9465"})] + ) + + assert len(result) == 1 + + return result[0] + + def it_references_the_descriptor_properly(result) -> None: + assert result["institutionTelephoneNumberTypeDescriptor"] == "uri://ed-fi.org/InstitutionTelephoneNumberTypeDescriptor#Main" + + def it_includes_the_telephone_number(result) -> None: + assert result["telephoneNumber"] == "(950) 325-9465" + From 9821d5ffedb9d68e8a5627bfc61fe7db2ae9c1c4 Mon Sep 17 00:00:00 2001 From: "Stephen A. Fuqua" Date: Fri, 24 Feb 2023 09:22:35 -0600 Subject: [PATCH 08/12] Type ignore in clients --- .../api/client/account.py | 9 ++-- .../api/client/assessment.py | 6 +-- .../api/client/bell_schedule.py | 2 +- .../api/client/calendar_date.py | 2 +- .../api/client/community.py | 4 +- .../api/client/course.py | 2 +- .../api/client/course_offering.py | 2 +- .../api/client/discipline.py | 4 +- .../api/client/education.py | 10 ++-- .../edfi_performance_test/api/client/grade.py | 2 +- .../api/client/gradebook_entries.py | 2 +- .../api/client/graduation_plan.py | 2 +- .../api/client/intervention.py | 4 +- .../api/client/parent.py | 8 ++-- .../api/client/post_secondary.py | 2 +- .../api/client/report_card.py | 2 +- .../api/client/section.py | 16 +++---- .../api/client/session.py | 8 ++-- .../edfi_performance_test/api/client/staff.py | 14 +++--- .../api/client/student.py | 48 +++++++++---------- .../factories/resources/staff.py | 1 - .../factories/resources/student.py | 1 - 22 files changed, 74 insertions(+), 77 deletions(-) diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/account.py b/src/edfi-performance-test/edfi_performance_test/api/client/account.py index 3463d807..43ab865c 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/account.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/account.py @@ -19,9 +19,8 @@ class AccountClient(EdFiAPIClient): } def create_with_dependencies(self, **kwargs): - # TODO: this is the only reference to account_code_client anywhere in - # the code base, so the next line should fail if it is ever called. - account_code_reference = self.account_code_client.create_with_dependencies() + # The constructor for ed_fi_api_client dynamically creates the `xyz_client` property using `setattr` + account_code_reference = self.account_code_client.create_with_dependencies() # type: ignore account_code_attrs = account_code_reference["attributes"] edorg_id = account_code_attrs["educationOrganizationReference"][ @@ -56,10 +55,10 @@ class _AccountDependentMixin(object): } def create_with_dependencies(self, **kwargs): - account_reference = self.account_client.create_with_dependencies() + account_reference = self.account_client.create_with_dependencies() # type: ignore account_identifier = account_reference["attributes"]["accountIdentifier"] - return self.create_using_dependencies( + return self.create_using_dependencies( # type: ignore account_reference, accountReference__accountIdentifier=account_identifier, **kwargs diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/assessment.py b/src/edfi-performance-test/edfi_performance_test/api/client/assessment.py index 53b90510..b5d6e025 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/assessment.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/assessment.py @@ -18,7 +18,7 @@ class AssessmentItemClient(EdFiAPIClient): def create_with_dependencies(self, **kwargs): # Create new assessment - assessment_reference = self.assessment_client.create_with_dependencies() + assessment_reference = self.assessment_client.create_with_dependencies() # type: ignore # Create assessment item return self.create_using_dependencies( @@ -45,7 +45,7 @@ class ObjectiveAssessmentClient(EdFiAPIClient): def create_with_dependencies(self, **kwargs): # Create new assessment - assessment_reference = self.assessment_client.create_with_dependencies() + assessment_reference = self.assessment_client.create_with_dependencies() # type: ignore # Create objective assessment return self.create_using_dependencies( @@ -64,7 +64,7 @@ class StudentAssessmentClient(EdFiAPIClient): def create_with_dependencies(self, **kwargs): # Create new assessment - assessment_reference = self.assessment_client.create_with_dependencies() + assessment_reference = self.assessment_client.create_with_dependencies() # type: ignore # Create student assessment return self.create_using_dependencies( diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/bell_schedule.py b/src/edfi-performance-test/edfi_performance_test/api/client/bell_schedule.py index a30afd93..358d35eb 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/bell_schedule.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/bell_schedule.py @@ -15,7 +15,7 @@ class BellScheduleClient(EdFiAPIClient): def create_with_dependencies(self, **kwargs): # Create new class period - class_period_reference = self.class_period_client.create_with_dependencies() + class_period_reference = self.class_period_client.create_with_dependencies() # type: ignore # Create bell schedule return self.create_using_dependencies( diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/calendar_date.py b/src/edfi-performance-test/edfi_performance_test/api/client/calendar_date.py index ef6e4da6..e0c8086d 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/calendar_date.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/calendar_date.py @@ -22,7 +22,7 @@ def create_with_dependencies(self, **kwargs): "calendarCode", RandomSuffixAttribute("107SS111111") ) # Create a calendar - calendar_reference = self.calendar_client.create_with_dependencies( + calendar_reference = self.calendar_client.create_with_dependencies( # type: ignore schoolReference__schoolId=school_id, calendarCode=custom_calendar_code ) diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/community.py b/src/edfi-performance-test/edfi_performance_test/api/client/community.py index 21f81c3f..00316139 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/community.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/community.py @@ -20,7 +20,7 @@ class CommunityProviderClient(EdFiAPIClient): } def create_with_dependencies(self, **kwargs): - org_reference = self.org_client.create_with_dependencies() + org_reference = self.org_client.create_with_dependencies() # type: ignore return self.create_using_dependencies( org_reference, @@ -41,7 +41,7 @@ class CommunityProviderLicenseClient(EdFiAPIClient): } def create_with_dependencies(self, **kwargs): - provider_reference = self.provider_client.create_with_dependencies() + provider_reference = self.provider_client.create_with_dependencies() # type: ignore return self.create_using_dependencies( provider_reference, diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/course.py b/src/edfi-performance-test/edfi_performance_test/api/client/course.py index f1ce16ef..209e6f39 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/course.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/course.py @@ -24,7 +24,7 @@ class CourseTranscriptClient(EdFiAPIClient): def create_with_dependencies(self, **kwargs): school_id = kwargs.pop("schoolId", SchoolClient.shared_elementary_school_id()) - record_reference = self.record_client.create_with_dependencies( + record_reference = self.record_client.create_with_dependencies( # type: ignore schoolId=school_id ) diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/course_offering.py b/src/edfi-performance-test/edfi_performance_test/api/client/course_offering.py index 22bcf4bb..2dd172e3 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/course_offering.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/course_offering.py @@ -16,7 +16,7 @@ class CourseOfferingClient(EdFiAPIClient): def create_with_dependencies(self, **kwargs): school_id = kwargs.pop("schoolId", SchoolClient.shared_elementary_school_id()) school_year = kwargs.get("schoolYear", 2014) - session_reference = self.session_client.create_with_dependencies( + session_reference = self.session_client.create_with_dependencies( # type: ignore schoolId=school_id, schoolYear=school_year ) diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/discipline.py b/src/edfi-performance-test/edfi_performance_test/api/client/discipline.py index bc0240c0..d1c0ae87 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/discipline.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/discipline.py @@ -21,7 +21,7 @@ def create_with_dependencies(self, **kwargs): school_id = kwargs.pop("schoolId", SchoolClient.shared_elementary_school_id()) # Create staff - staff_reference = self.staff_client.create_with_dependencies(schoolId=school_id) + staff_reference = self.staff_client.create_with_dependencies(schoolId=school_id) # type: ignore # Create discipline incident return self.create_using_dependencies( @@ -47,7 +47,7 @@ def create_with_dependencies(self, **kwargs): # Create incident and association first school_id = kwargs.pop("schoolId", SchoolClient.shared_elementary_school_id()) - assoc_reference = self.assoc_client.create_with_dependencies(schoolId=school_id) + assoc_reference = self.assoc_client.create_with_dependencies(schoolId=school_id) # type: ignore # Create discipline action return self.create_using_dependencies( diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/education.py b/src/edfi-performance-test/edfi_performance_test/api/client/education.py index c4cf0ae6..ac7eb8a3 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/education.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/education.py @@ -26,7 +26,7 @@ class EducationOrganizationInterventionPrescriptionAssociationClient(EdFiAPIClie } def create_with_dependencies(self, **kwargs): - rx_reference = self.prescription_client.create_with_dependencies() + rx_reference = self.prescription_client.create_with_dependencies() # type: ignore return self.create_using_dependencies( rx_reference, @@ -52,7 +52,7 @@ class EducationOrganizationNetworkAssociationClient(EdFiAPIClient): } def create_with_dependencies(self, **kwargs): - network_reference = self.network_client.create_with_dependencies() + network_reference = self.network_client.create_with_dependencies() # type: ignore return self.create_using_dependencies( network_reference, @@ -73,7 +73,7 @@ class EducationOrganizationPeerAssociationClient(EdFiAPIClient): } def create_with_dependencies(self, **kwargs): - school_reference = self.school_client.create_with_dependencies() + school_reference = self.school_client.create_with_dependencies() # type: ignore return self.create_using_dependencies( school_reference, @@ -103,7 +103,7 @@ class LocalEducationAgencyClient(EdFiAPIClient): } def create_with_dependencies(self, **kwargs): - service_center_reference = self.service_center_client.create_with_dependencies() + service_center_reference = self.service_center_client.create_with_dependencies() # type: ignore return self.create_using_dependencies( service_center_reference, @@ -136,7 +136,7 @@ class FeederSchoolAssociationClient(EdFiAPIClient): } def create_with_dependencies(self, **kwargs): - feeder_school_reference = self.school_client.create_with_dependencies() + feeder_school_reference = self.school_client.create_with_dependencies() # type: ignore return self.create_using_dependencies( feeder_school_reference, diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/grade.py b/src/edfi-performance-test/edfi_performance_test/api/client/grade.py index 503e50c6..1a477a72 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/grade.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/grade.py @@ -23,7 +23,7 @@ def create_with_dependencies(self, **kwargs): school_id = kwargs.pop("schoolId", SchoolClient.shared_elementary_school_id()) course_code = kwargs.pop("courseCode", "ELA-01") - assoc_reference = self.section_assoc_client.create_with_dependencies( + assoc_reference = self.section_assoc_client.create_with_dependencies( # type: ignore schoolId=school_id, courseCode=course_code ) grade_period = assoc_reference["dependency_ids"]["section_client"][ diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/gradebook_entries.py b/src/edfi-performance-test/edfi_performance_test/api/client/gradebook_entries.py index b6d06a66..bcdf8d03 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/gradebook_entries.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/gradebook_entries.py @@ -16,7 +16,7 @@ class GradebookEntryClient(EdFiAPIClient): } def create_with_dependencies(self, **kwargs): - section_reference = self.section_client.create_with_dependencies() + section_reference = self.section_client.create_with_dependencies() # type: ignore section_attrs = section_reference["attributes"] return self.create_using_dependencies( diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/graduation_plan.py b/src/edfi-performance-test/edfi_performance_test/api/client/graduation_plan.py index 32c88991..91cfe013 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/graduation_plan.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/graduation_plan.py @@ -16,7 +16,7 @@ class GraduationPlanClient(EdFiAPIClient): } def create_with_dependencies(self, **kwargs): - school_reference = self.school_client.create_with_dependencies() + school_reference = self.school_client.create_with_dependencies() # type: ignore return self.create_using_dependencies( school_reference, diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/intervention.py b/src/edfi-performance-test/edfi_performance_test/api/client/intervention.py index f0a86f47..225a312f 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/intervention.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/intervention.py @@ -21,7 +21,7 @@ class InterventionClient(EdFiAPIClient): def create_with_dependencies(self, **kwargs): # Create intervention prescription - rx_reference = self.prescription_client.create_with_dependencies() + rx_reference = self.prescription_client.create_with_dependencies() # type: ignore # Create intervention return self.create_using_dependencies( @@ -45,7 +45,7 @@ class InterventionStudyClient(EdFiAPIClient): def create_with_dependencies(self, **kwargs): # Create intervention prescription - rx_reference = self.prescription_client.create_with_dependencies() + rx_reference = self.prescription_client.create_with_dependencies() # type: ignore # Create intervention return self.create_using_dependencies( diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/parent.py b/src/edfi-performance-test/edfi_performance_test/api/client/parent.py index 01ad8b40..25a9b064 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/parent.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/parent.py @@ -28,12 +28,12 @@ def create_with_dependencies(self, **kwargs): parent_id = self.create(**parent_attrs) # Create enrolled student - student_reference = self.student_client.create_with_dependencies( + student_reference = self.student_client.create_with_dependencies( # type: ignore schoolId=school_id ) # Associate parent with student to allow updates - assoc_id = self.parent_assoc_client.create( + assoc_id = self.parent_assoc_client.create( # type: ignore parentReference__parentUniqueId=parent_unique_id, studentReference__studentUniqueId=student_reference["attributes"][ "studentUniqueId" @@ -50,8 +50,8 @@ def create_with_dependencies(self, **kwargs): } def delete_with_dependencies(self, reference, **kwargs): - self.parent_assoc_client.delete_item(reference["dependency_ids"]["assoc_id"]) - self.student_client.delete_with_dependencies( + self.parent_assoc_client.delete_item(reference["dependency_ids"]["assoc_id"]) # type: ignore + self.student_client.delete_with_dependencies( # type: ignore reference["dependency_ids"]["student_reference"] ) self.delete_item(reference["resource_id"]) diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/post_secondary.py b/src/edfi-performance-test/edfi_performance_test/api/client/post_secondary.py index c6c88188..10004a8c 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/post_secondary.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/post_secondary.py @@ -20,7 +20,7 @@ class PostSecondaryEventClient(EdFiAPIClient): def create_with_dependencies(self, **kwargs): # Create new student for association - institution_reference = self.institution_client.create_with_dependencies() + institution_reference = self.institution_client.create_with_dependencies() # type: ignore return self.create_using_dependencies( institution_reference, diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/report_card.py b/src/edfi-performance-test/edfi_performance_test/api/client/report_card.py index 280b7257..d76551ad 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/report_card.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/report_card.py @@ -16,7 +16,7 @@ class ReportCardClient(EdFiAPIClient): } def create_with_dependencies(self, **kwargs): - period_reference = self.grading_period_client.create_with_dependencies() + period_reference = self.grading_period_client.create_with_dependencies() # type: ignore return self.create_using_dependencies( period_reference, diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/section.py b/src/edfi-performance-test/edfi_performance_test/api/client/section.py index 57abbade..42c4661c 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/section.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/section.py @@ -28,7 +28,7 @@ def create_with_dependencies(self, **kwargs): # Create a course offering and its dependencies course_offering_reference = ( - self.course_offering_client.create_with_dependencies( + self.course_offering_client.create_with_dependencies( # type: ignore schoolId=school_id, schoolYear=school_year, courseReference__courseCode=custom_course_code, @@ -39,12 +39,12 @@ def create_with_dependencies(self, **kwargs): course_offering_attrs = course_offering_reference["attributes"] # Create a class period - class_period_reference = self.class_period_client.create_with_dependencies( + class_period_reference = self.class_period_client.create_with_dependencies( # type: ignore schoolReference__schoolId=school_id, ) # Create a location - location_reference = self.location_client.create_with_dependencies( + location_reference = self.location_client.create_with_dependencies( # type: ignore schoolReference__schoolId=school_id, ) @@ -91,11 +91,11 @@ def create_with_dependencies(self, **kwargs): def delete_with_dependencies(self, reference, **kwargs): self.delete_item(reference["resource_id"]) depend = reference["dependency_ids"] - self.location_client.delete_with_dependencies(depend["location_reference"]) - self.class_period_client.delete_with_dependencies( + self.location_client.delete_with_dependencies(depend["location_reference"]) # type: ignore + self.class_period_client.delete_with_dependencies( # type: ignore depend["class_period_reference"] ) - self.course_offering_client.delete_with_dependencies( + self.course_offering_client.delete_with_dependencies( # type: ignore depend["course_offering_reference"] ) @@ -110,13 +110,13 @@ class SectionAttendanceTakenEventClient(EdFiAPIClient): def create_with_dependencies(self, **kwargs): school_id = kwargs.pop("schoolId", SchoolClient.shared_elementary_school_id()) - calendar_date_reference = self.calendar_date_client.create_with_dependencies( + calendar_date_reference = self.calendar_date_client.create_with_dependencies( # type: ignore schoolId=school_id, ) calendar_date_attrs = calendar_date_reference["attributes"] calendarSchoolYear = calendar_date_attrs["calendarReference"]["schoolYear"] - section_reference = self.section_client.create_with_dependencies( + section_reference = self.section_client.create_with_dependencies( # type: ignore schoolId=school_id, schoolYear=calendarSchoolYear ) section_attrs = section_reference["attributes"] diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/session.py b/src/edfi-performance-test/edfi_performance_test/api/client/session.py index c78b53a8..42848aac 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/session.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/session.py @@ -19,11 +19,11 @@ def create_with_dependencies(self, **kwargs): school_id = kwargs.pop("schoolId", SchoolClient.shared_elementary_school_id()) school_year = kwargs.get("schoolYear", 2014) # Create two grading periods - period_1_reference = self.grading_period_client.create_with_dependencies( + period_1_reference = self.grading_period_client.create_with_dependencies( # type: ignore schoolReference__schoolId=school_id, schoolYearTypeReference__schoolYear=school_year, ) - period_2_reference = self.grading_period_client.create_with_dependencies( + period_2_reference = self.grading_period_client.create_with_dependencies( # type: ignore schoolReference__schoolId=school_id, schoolYearTypeReference__schoolYear=school_year, beginDate="2014-10-06", @@ -57,9 +57,9 @@ def create_with_dependencies(self, **kwargs): def delete_with_dependencies(self, reference, **kwargs): self.delete_item(reference["resource_id"]) - self.grading_period_client.delete_with_dependencies( + self.grading_period_client.delete_with_dependencies( # type: ignore reference["dependency_ids"]["period_1_reference"] ) - self.grading_period_client.delete_with_dependencies( + self.grading_period_client.delete_with_dependencies( # type: ignore reference["dependency_ids"]["period_2_reference"] ) diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/staff.py b/src/edfi-performance-test/edfi_performance_test/api/client/staff.py index d004e6c6..774037f4 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/staff.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/staff.py @@ -35,7 +35,7 @@ def create_with_dependencies(self, **kwargs): staff_id = self.create(**staff_attrs) # Associate staff with existing school to allow updates - assoc_id = self.assoc_client.create( + assoc_id = self.assoc_client.create( # type: ignore staffReference__staffUniqueId=staff_unique_id, educationOrganizationReference__educationOrganizationId=school_id, staffUniqueId=staff_unique_id, @@ -50,7 +50,7 @@ def create_with_dependencies(self, **kwargs): } def delete_with_dependencies(self, reference, **kwargs): - self.assoc_client.delete_item(reference["dependency_ids"]["assoc_id"]) + self.assoc_client.delete_item(reference["dependency_ids"]["assoc_id"]) # type: ignore self.delete_item(reference["resource_id"]) @classmethod @@ -93,12 +93,12 @@ def create_with_dependencies(self, **kwargs): school_id = kwargs.pop("schoolId", SchoolClient.shared_elementary_school_id()) # Create cohort - cohort_reference = self.cohort_client.create_with_dependencies( + cohort_reference = self.cohort_client.create_with_dependencies( # type: ignore educationOrganizationReference__educationOrganizationId=school_id, ) # Create staff - staff_reference = self.staff_client.create_with_dependencies(schoolId=school_id) + staff_reference = self.staff_client.create_with_dependencies(schoolId=school_id) # type: ignore # Create association between new staff and new cohort return self.create_using_dependencies( @@ -139,7 +139,7 @@ def create_with_dependencies(self, **kwargs): school_id = kwargs.pop("schoolId", SchoolClient.shared_elementary_school_id()) # Create staff record - staff_reference = self.staff_client.create_with_dependencies(schoolId=school_id) + staff_reference = self.staff_client.create_with_dependencies(schoolId=school_id) # type: ignore return self.create_using_dependencies( staff_reference, @@ -164,12 +164,12 @@ def create_with_dependencies(self, **kwargs): course_code = kwargs.pop("courseCode", "ELA-01") # Create section and staff - section_reference = self.section_client.create_with_dependencies( + section_reference = self.section_client.create_with_dependencies( # type: ignore schoolId=school_id, courseCode=course_code, sectionIdentifier=RandomSuffixAttribute(course_code + "2017RM555"), ) - staff_reference = self.staff_client.create_with_dependencies(schoolId=school_id) + staff_reference = self.staff_client.create_with_dependencies(schoolId=school_id) # type: ignore # Create association between staff and section sec_attrs = section_reference["attributes"] diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/student.py b/src/edfi-performance-test/edfi_performance_test/api/client/student.py index 7ec2771e..19588872 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/student.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/student.py @@ -24,7 +24,7 @@ class StudentParentAssociationClient(EdFiAPIClient): def create_with_dependencies(self, **kwargs): # Create enrolled student - student_reference = self.student_client.create_with_dependencies() + student_reference = self.student_client.create_with_dependencies() # type: ignore # Create parent parent_unique_id = kwargs.pop("parentUniqueId", ParentClient.shared_parent_id()) @@ -60,7 +60,7 @@ def create_with_dependencies(self, **kwargs): student_id = self.create(**student_attrs) # Associate student with existing school to allow updates - assoc_id = self.assoc_client.create( + assoc_id = self.assoc_client.create( # type: ignore studentReference__studentUniqueId=student_unique_id, schoolReference__schoolId=school_id, studentUniqueId=student_unique_id, @@ -75,7 +75,7 @@ def create_with_dependencies(self, **kwargs): } def delete_with_dependencies(self, reference, **kwargs): - self.assoc_client.delete_item(reference["dependency_ids"]["assoc_id"]) + self.assoc_client.delete_item(reference["dependency_ids"]["assoc_id"]) # type: ignore self.delete_item(reference["resource_id"]) @classmethod @@ -116,7 +116,7 @@ def create_with_dependencies(self, **kwargs): school_id = kwargs.pop("schoolId", SchoolClient.shared_elementary_school_id()) # Create enrolled student - student_reference = self.student_client.create_with_dependencies( + student_reference = self.student_client.create_with_dependencies( # type: ignore schoolId=school_id ) @@ -142,12 +142,12 @@ def create_with_dependencies(self, **kwargs): school_id = kwargs.pop("schoolId", SchoolClient.shared_elementary_school_id()) # Create enrolled student - student_reference = self.student_client.create_with_dependencies( + student_reference = self.student_client.create_with_dependencies( # type: ignore schoolId=school_id ) # Create a cohort - cohort_reference = self.cohort_client.create_with_dependencies( + cohort_reference = self.cohort_client.create_with_dependencies( # type: ignore educationOrganizationReference__educationOrganizationId=school_id ) @@ -179,7 +179,7 @@ def create_with_dependencies(self, **kwargs): school_id = kwargs.pop("schoolId", SchoolClient.shared_elementary_school_id()) # Create enrolled student - student_reference = self.student_client.create_with_dependencies( + student_reference = self.student_client.create_with_dependencies( # type: ignore schoolId=school_id ) @@ -204,7 +204,7 @@ def create_with_dependencies(self, **kwargs): school_id = kwargs.pop("schoolId", SchoolClient.shared_elementary_school_id()) # Create enrolled student - student_reference = self.student_client.create_with_dependencies( + student_reference = self.student_client.create_with_dependencies( # type: ignore schoolId=school_id ) @@ -227,7 +227,7 @@ def create_with_dependencies(self, **kwargs): school_id = kwargs.pop("schoolId", SchoolClient.shared_elementary_school_id()) # Create enrolled student - student_reference = self.student_client.create_with_dependencies( + student_reference = self.student_client.create_with_dependencies( # type: ignore schoolId=school_id ) @@ -255,12 +255,12 @@ def create_with_dependencies(self, **kwargs): school_id = kwargs.pop("schoolId", SchoolClient.shared_elementary_school_id()) # Create enrolled student - student_reference = self.student_client.create_with_dependencies( + student_reference = self.student_client.create_with_dependencies( # type: ignore schoolId=school_id ) # Create discipline incident - incident_reference = self.incident_client.create_with_dependencies( + incident_reference = self.incident_client.create_with_dependencies( # type: ignore schoolId=school_id ) @@ -293,12 +293,12 @@ def create_with_dependencies(self, **kwargs): school_id = kwargs.get("schoolId", SchoolClient.shared_elementary_school_id()) course_code = kwargs.pop("courseCode", "ELA-01") # Create section and student - section_reference = self.section_client.create_with_dependencies( + section_reference = self.section_client.create_with_dependencies( # type: ignore schoolId=school_id, courseCode=course_code, sectionIdentifier=RandomSuffixAttribute(course_code + "2017RM555"), ) - student_reference = self.student_client.create_with_dependencies( + student_reference = self.student_client.create_with_dependencies( # type: ignore schoolId=school_id ) student_unique_id = student_reference["attributes"]["studentUniqueId"] @@ -340,12 +340,12 @@ def create_with_dependencies(self, **kwargs): school_id = kwargs.pop("schoolId", SchoolClient.shared_elementary_school_id()) # Create enrolled student - student_reference = self.student_client.create_with_dependencies( + student_reference = self.student_client.create_with_dependencies( # type: ignore schoolId=school_id ) # Create session - session_reference = self.session_client.create_with_dependencies( + session_reference = self.session_client.create_with_dependencies( # type: ignore schoolId=school_id ) @@ -380,12 +380,12 @@ def create_with_dependencies(self, **kwargs): course_code = kwargs.pop("courseCode", "ELA-01") # Create enrolled student - student_reference = self.student_client.create_with_dependencies( + student_reference = self.student_client.create_with_dependencies( # type: ignore schoolId=school_id ) # Create section - section_reference = self.section_client.create_with_dependencies( + section_reference = self.section_client.create_with_dependencies( # type: ignore schoolId=school_id, courseCode=course_code, sectionIdentifier=RandomSuffixAttribute(course_code + "2017RM555"), @@ -429,7 +429,7 @@ def create_with_dependencies(self, **kwargs): school_id = kwargs.pop("schoolId", SchoolClient.shared_elementary_school_id()) # Create enrolled student - student_reference = self.student_client.create_with_dependencies( + student_reference = self.student_client.create_with_dependencies( # type: ignore schoolId=school_id ) @@ -454,11 +454,11 @@ class StudentCompetencyObjectiveClient(EdFiAPIClient): def create_with_dependencies(self, **kwargs): # Create grading period - period_reference = self.grading_period_client.create_with_dependencies() + period_reference = self.grading_period_client.create_with_dependencies() # type: ignore # Create competency objective objective_reference = ( - self.competency_objective_client.create_with_dependencies() + self.competency_objective_client.create_with_dependencies() # type: ignore ) # Create student competency objective @@ -560,7 +560,7 @@ class StudentInterventionAssociationClient(EdFiAPIClient): } def create_with_dependencies(self, **kwargs): - intervention_reference = self.intervention_client.create_with_dependencies() + intervention_reference = self.intervention_client.create_with_dependencies() # type: ignore return self.create_using_dependencies( intervention_reference, @@ -581,7 +581,7 @@ class StudentInterventionAttendanceEventClient(EdFiAPIClient): } def create_with_dependencies(self, **kwargs): - intervention_reference = self.intervention_client.create_with_dependencies() + intervention_reference = self.intervention_client.create_with_dependencies() # type: ignore return self.create_using_dependencies( intervention_reference, @@ -607,9 +607,9 @@ class StudentLearningObjectiveClient(EdFiAPIClient): } def create_with_dependencies(self, **kwargs): - objective_reference = self.objective_client.create_with_dependencies() + objective_reference = self.objective_client.create_with_dependencies() # type: ignore - period_reference = self.grading_period_client.create_with_dependencies() + period_reference = self.grading_period_client.create_with_dependencies() # type: ignore return self.create_using_dependencies( [ diff --git a/src/edfi-performance-test/edfi_performance_test/factories/resources/staff.py b/src/edfi-performance-test/edfi_performance_test/factories/resources/staff.py index 530012a5..44833912 100644 --- a/src/edfi-performance-test/edfi_performance_test/factories/resources/staff.py +++ b/src/edfi-performance-test/edfi_performance_test/factories/resources/staff.py @@ -50,7 +50,6 @@ class StaffEducationOrganizationAssignmentAssociationFactory(APIFactory): class StaffFactory(APIFactory): staffUniqueId = UniqueIdAttribute() firstName = "John" - middleName = "" lastSurname = "Loyo" hispanicLatinoEthnicity = True birthDate = "1959-04-30" diff --git a/src/edfi-performance-test/edfi_performance_test/factories/resources/student.py b/src/edfi-performance-test/edfi_performance_test/factories/resources/student.py index ede136b4..4655fcd8 100644 --- a/src/edfi-performance-test/edfi_performance_test/factories/resources/student.py +++ b/src/edfi-performance-test/edfi_performance_test/factories/resources/student.py @@ -307,7 +307,6 @@ class StudentSectionAttendanceEventFactory(APIFactory): "AttendanceEventCategory", "Tardy" ) eventDate = formatted_date(9, 16) - attendanceEventReason = "" class StudentAcademicRecordFactory(APIFactory): From d57fa1c90190fc15cd428e722758fb57a9bd1091 Mon Sep 17 00:00:00 2001 From: "Stephen A. Fuqua" Date: Mon, 27 Feb 2023 09:27:06 -0600 Subject: [PATCH 09/12] this descriptor is part of the natural key and shouldn't be changeable --- .../edfi_performance_test/tasks/pipeclean/account.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/account.py b/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/account.py index d5e4bf8a..4c79f136 100644 --- a/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/account.py +++ b/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/account.py @@ -16,8 +16,8 @@ class AccountPipecleanTest(EdFiPipecleanTestBase): class AccountCodePipecleanTest(EdFiPipecleanTestBase): - update_attribute_name = "accountClassificationDescriptor" - update_attribute_value = build_descriptor("AccountClassification", "Fund") + update_attribute_name = "accountCodeDescription" + update_attribute_value = "another description" class ActualPipecleanTest(EdFiPipecleanTestBase): From b004ef7db35cd709e5ab1290c28cf4d61d8cab9f Mon Sep 17 00:00:00 2001 From: "Stephen A. Fuqua" Date: Mon, 27 Feb 2023 09:27:58 -0600 Subject: [PATCH 10/12] Fixing modeling mistakes that the ODS/API would forgive, but meadowlark won't --- .gitattributes | 2 + .../api/client/composite.py | 4 + .../api/client/course_offering.py | 3 +- .../api/client/section.py | 5 +- .../api/client/session.py | 5 +- .../edfi_performance_test/api/client/staff.py | 16 +- .../api/client/student.py | 23 ++- .../factories/resources/assessment.py | 13 +- .../factories/resources/bell_schedule.py | 2 +- .../factories/resources/course.py | 1 + .../factories/resources/discipline.py | 2 +- .../factories/resources/education.py | 4 +- .../factories/resources/grading_period.py | 3 +- .../factories/resources/session.py | 4 + .../factories/resources/student.py | 163 ++++++++---------- .../edfi_performance_test/factories/utils.py | 9 + .../tasks/pipeclean/assessment.py | 2 +- .../tasks/pipeclean/class_period.py | 1 + .../tasks/pipeclean/competency_objective.py | 4 +- .../tasks/pipeclean/descriptors.py | 2 +- .../tasks/pipeclean/education.py | 7 +- .../tasks/pipeclean/gradebook_entries.py | 1 + .../tasks/pipeclean/parent.py | 2 +- .../tasks/pipeclean/post_secondary.py | 8 +- .../tasks/pipeclean/program.py | 4 +- .../tasks/pipeclean/student.py | 7 +- 26 files changed, 153 insertions(+), 144 deletions(-) diff --git a/.gitattributes b/.gitattributes index 4a2dfcc8..41bf0cce 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,5 @@ +* text eol=lf + *.md text *.txt text *.py text diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/composite.py b/src/edfi-performance-test/edfi_performance_test/api/client/composite.py index f8a99e67..16757a30 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/composite.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/composite.py @@ -44,5 +44,9 @@ def _get_all(self, resource): response = self._get_response( "get", list_endpoint, headers=self.get_headers(), name=list_endpoint ) + + if not response.ok: + raise RuntimeError(f"Composite resource '{resource}' does not exist (404)") + self.log_response(response) return json.loads(response.text) diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/course_offering.py b/src/edfi-performance-test/edfi_performance_test/api/client/course_offering.py index 2dd172e3..5282598e 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/course_offering.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/course_offering.py @@ -15,7 +15,8 @@ class CourseOfferingClient(EdFiAPIClient): def create_with_dependencies(self, **kwargs): school_id = kwargs.pop("schoolId", SchoolClient.shared_elementary_school_id()) - school_year = kwargs.get("schoolYear", 2014) + school_year = kwargs.pop("schoolYear", 2014) + session_reference = self.session_client.create_with_dependencies( # type: ignore schoolId=school_id, schoolYear=school_year ) diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/section.py b/src/edfi-performance-test/edfi_performance_test/api/client/section.py index 42c4661c..7ad59bf3 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/section.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/section.py @@ -22,8 +22,8 @@ class SectionClient(EdFiAPIClient): } def create_with_dependencies(self, **kwargs): - school_id = kwargs.get("schoolId", SchoolClient.shared_elementary_school_id()) - school_year = kwargs.get("schoolYear", 2014) + school_id = kwargs.pop("schoolId", SchoolClient.shared_elementary_school_id()) + school_year = kwargs.pop("schoolYear", 2014) custom_course_code = kwargs.pop("courseCode", "ELA-01") # Create a course offering and its dependencies @@ -55,6 +55,7 @@ def create_with_dependencies(self, **kwargs): ][ "classPeriodName" ], + classPeriods__0__classPeriodReference__schoolId=school_id, courseOfferingReference__localCourseCode=course_offering_attrs[ "localCourseCode" ], diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/session.py b/src/edfi-performance-test/edfi_performance_test/api/client/session.py index 42848aac..e1663585 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/session.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/session.py @@ -16,8 +16,11 @@ class SessionClient(EdFiAPIClient): dependencies: Dict = {GradingPeriodClient: {}} def create_with_dependencies(self, **kwargs): + # is schoolyear a kwarg? + school_id = kwargs.pop("schoolId", SchoolClient.shared_elementary_school_id()) - school_year = kwargs.get("schoolYear", 2014) + school_year = kwargs.pop("schoolYear", 2014) + # Create two grading periods period_1_reference = self.grading_period_client.create_with_dependencies( # type: ignore schoolReference__schoolId=school_id, diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/staff.py b/src/edfi-performance-test/edfi_performance_test/api/client/staff.py index 774037f4..41d0aa1a 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/staff.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/staff.py @@ -38,7 +38,6 @@ def create_with_dependencies(self, **kwargs): assoc_id = self.assoc_client.create( # type: ignore staffReference__staffUniqueId=staff_unique_id, educationOrganizationReference__educationOrganizationId=school_id, - staffUniqueId=staff_unique_id, ) return { @@ -65,16 +64,13 @@ class StaffEducationOrganizationAssignmentAssociationClient(EdFiAPIClient): endpoint = "staffEducationOrganizationAssignmentAssociations" def create_with_dependencies(self, **kwargs): - # Create new staff for association - staff_unique_id = kwargs.pop("staffUniqueId", StaffClient.shared_staff_id()) - - # Create association from staff to ed org - edorg_id = kwargs.pop( - "educationOrganizationId", SchoolClient.shared_elementary_school_id() - ) assoc_overrides = dict( - staffReference__staffUniqueId=staff_unique_id, - educationOrganizationReference__educationOrganizationId=edorg_id, + staffReference__staffUniqueId=kwargs.pop( + "staffUniqueId", StaffClient.shared_staff_id() + ), + educationOrganizationReference__educationOrganizationId=kwargs.pop( + "educationOrganizationId", SchoolClient.shared_elementary_school_id() + ), ) assoc_overrides.update(kwargs) return self.create_using_dependencies(**assoc_overrides) diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/student.py b/src/edfi-performance-test/edfi_performance_test/api/client/student.py index 19588872..025facde 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/student.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/student.py @@ -62,8 +62,7 @@ def create_with_dependencies(self, **kwargs): # Associate student with existing school to allow updates assoc_id = self.assoc_client.create( # type: ignore studentReference__studentUniqueId=student_unique_id, - schoolReference__schoolId=school_id, - studentUniqueId=student_unique_id, + schoolReference__schoolId=school_id ) return { @@ -90,13 +89,11 @@ class StudentSchoolAssociationClient(EdFiAPIClient): endpoint = "studentSchoolAssociations" def create_with_dependencies(self, **kwargs): - # Create new student for association - student_unique_id = kwargs.pop( - "studentUniqueId", StudentClient.shared_student_id() - ) - # Create association from student to school school_id = kwargs.pop("schoolId", SchoolClient.shared_elementary_school_id()) + # This is coming back with a function, and we need to call that function + student_unique_id = kwargs.pop("student_unique_id", StudentClient.shared_student_id()) + assoc_overrides = dict( studentReference__studentUniqueId=student_unique_id, schoolReference__schoolId=school_id, @@ -290,7 +287,7 @@ class StudentSectionAssociationClient(EdFiAPIClient): } def create_with_dependencies(self, **kwargs): - school_id = kwargs.get("schoolId", SchoolClient.shared_elementary_school_id()) + school_id = kwargs.pop("schoolId", SchoolClient.shared_elementary_school_id()) course_code = kwargs.pop("courseCode", "ELA-01") # Create section and student section_reference = self.section_client.create_with_dependencies( # type: ignore @@ -470,7 +467,7 @@ def create_with_dependencies(self, **kwargs): gradingPeriodReference__periodSequence=period_reference["attributes"][ "periodSequence" ], - objectiveCompetencyObjectiveReference__objective=objective_reference[ + competencyObjectiveReference__objective=objective_reference[ "attributes" ]["objective"], ) @@ -496,7 +493,7 @@ class StudentGradebookEntryClient(EdFiAPIClient): def create_with_dependencies(self, **kwargs): # Create a student and section - student_section_reference = self.assoc_client.create_with_dependencies() + student_section_reference = self.assoc_client.create_with_dependencies() # type: ignore section_kwargs = { "sectionIdentifier": student_section_reference["attributes"][ "sectionReference" @@ -516,7 +513,7 @@ def create_with_dependencies(self, **kwargs): } # Create gradebook entry - entry_id, gradebook_entry_title = self.entry_client.create( + entry_id, gradebook_entry_title = self.entry_client.create( # type: ignore unique_id_field="gradebookEntryTitle", sectionReference=section_kwargs ) @@ -544,8 +541,8 @@ def create_with_dependencies(self, **kwargs): def delete_with_dependencies(self, reference, **kwargs): self.delete_item(reference["resource_id"]) dependencies = reference["dependency_ids"] - self.entry_client.delete_item(dependencies["entry_client"]) - self.assoc_client.delete_with_dependencies(dependencies["assoc_client"]) + self.entry_client.delete_item(dependencies["entry_client"]) # type: ignore + self.assoc_client.delete_with_dependencies(dependencies["assoc_client"]) # type: ignore class StudentHomelessProgramAssociationClient(EdFiAPIClient): diff --git a/src/edfi-performance-test/edfi_performance_test/factories/resources/assessment.py b/src/edfi-performance-test/edfi_performance_test/factories/resources/assessment.py index 81552807..e4131f4e 100644 --- a/src/edfi-performance-test/edfi_performance_test/factories/resources/assessment.py +++ b/src/edfi-performance-test/edfi_performance_test/factories/resources/assessment.py @@ -12,6 +12,7 @@ RandomDateAttribute, RandomSuffixAttribute, UniqueIdAttribute, + random_date_time, ) @@ -88,7 +89,9 @@ class AssessmentFactory(APIFactory): assessmentReportingMethodDescriptor=build_descriptor( "AssessmentReportingMethod", "Scale score" ), - resultDatatypeType="Integer", + resultDatatypeTypeDescriptor=build_descriptor( + "ResultDatatypeType", "Integer" + ), maximumScore="25", minimumScore="0", ) @@ -119,8 +122,7 @@ class LearningObjectiveFactory(APIFactory): dict( academicSubjectDescriptor=build_descriptor( "AcademicSubject", "Mathematics" - ), - namespace="uri://ed-fi.org/", + ) ) ) ] @@ -164,6 +166,7 @@ class LearningStandardFactory(APIFactory): ), ] ) + contentStandard = factory.Dict(dict(title="State Standard")) class ObjectiveAssessmentFactory(APIFactory): @@ -188,9 +191,7 @@ class StudentAssessmentFactory(APIFactory): namespace="uri://ed-fi.org/Assessment/Assessment.xml", ) ) - administrationDate = ( - RandomDateAttribute() - ) # Along with studentReference and assessmentReference, this is the PK + administrationDate = random_date_time() # Along with studentReference and assessmentReference, this is the PK administrationEnvironmentDescriptor = build_descriptor( "AdministrationEnvironment", "Testing Center" ) diff --git a/src/edfi-performance-test/edfi_performance_test/factories/resources/bell_schedule.py b/src/edfi-performance-test/edfi_performance_test/factories/resources/bell_schedule.py index 3d78bd6f..1a742a54 100644 --- a/src/edfi-performance-test/edfi_performance_test/factories/resources/bell_schedule.py +++ b/src/edfi-performance-test/edfi_performance_test/factories/resources/bell_schedule.py @@ -19,7 +19,7 @@ class BellScheduleFactory(APIFactory): [ factory.Dict( dict( - classPeriodReference=factory.Dict(dict(classPeriodName=None)), + classPeriodReference=factory.Dict(dict(classPeriodName=None, schoolId=SchoolClient.shared_elementary_school_id())), ) ), ] diff --git a/src/edfi-performance-test/edfi_performance_test/factories/resources/course.py b/src/edfi-performance-test/edfi_performance_test/factories/resources/course.py index 616a8cac..92717988 100644 --- a/src/edfi-performance-test/edfi_performance_test/factories/resources/course.py +++ b/src/edfi-performance-test/edfi_performance_test/factories/resources/course.py @@ -62,3 +62,4 @@ class CourseTranscriptFactory(APIFactory): courseAttemptResultDescriptor = build_descriptor("CourseAttemptResult", "Pass") finalLetterGradeEarned = "B" finalNumericGradeEarned = 83 + earnedCredits = 3 diff --git a/src/edfi-performance-test/edfi_performance_test/factories/resources/discipline.py b/src/edfi-performance-test/edfi_performance_test/factories/resources/discipline.py index a2e0f462..12c8d3fd 100644 --- a/src/edfi-performance-test/edfi_performance_test/factories/resources/discipline.py +++ b/src/edfi-performance-test/edfi_performance_test/factories/resources/discipline.py @@ -67,6 +67,6 @@ class DisciplineIncidentFactory(APIFactory): ) ] ) - incidentLocationDescriptor = build_descriptor("IncidentLocation", "School Bus") + incidentLocationDescriptor = build_descriptor("IncidentLocation", "School bus") reporterDescriptionDescriptor = build_descriptor("ReporterDescription", "Staff") reporterName = "Villa, Mike" diff --git a/src/edfi-performance-test/edfi_performance_test/factories/resources/education.py b/src/edfi-performance-test/edfi_performance_test/factories/resources/education.py index 3dd7fab0..e336739b 100644 --- a/src/edfi-performance-test/edfi_performance_test/factories/resources/education.py +++ b/src/edfi-performance-test/edfi_performance_test/factories/resources/education.py @@ -66,8 +66,10 @@ class LocalEducationAgencyFactory(APIFactory): class EducationContentFactory(APIFactory): contentIdentifier = UniqueIdAttribute(num_chars=60) - description = "A learning resource for all grade levels" + shortDescription = "A learning resource for all grade levels" namespace = "uri://ed-fi.org" + learningResourceMetadataURI = "uri://ed-fi.org/whatever" + contentClassDescriptor = "uri://ed-fi.org/ContentClassDescriptor#Presentation" class EducationOrganizationInterventionPrescriptionAssociationFactory(APIFactory): diff --git a/src/edfi-performance-test/edfi_performance_test/factories/resources/grading_period.py b/src/edfi-performance-test/edfi_performance_test/factories/resources/grading_period.py index b012c13d..ec3b74bd 100644 --- a/src/edfi-performance-test/edfi_performance_test/factories/resources/grading_period.py +++ b/src/edfi-performance-test/edfi_performance_test/factories/resources/grading_period.py @@ -8,11 +8,10 @@ from edfi_performance_test.api.client.school import SchoolClient from edfi_performance_test.factories.resources.api_factory import APIFactory from edfi_performance_test.factories.descriptors.utils import build_descriptor -from edfi_performance_test.factories.utils import UniquePrimaryKeyAttribute class GradingPeriodFactory(APIFactory): - periodSequence = UniquePrimaryKeyAttribute() + periodSequence = 1 beginDate = "2014-08-23" endDate = "2014-10-04" totalInstructionalDays = 29 diff --git a/src/edfi-performance-test/edfi_performance_test/factories/resources/session.py b/src/edfi-performance-test/edfi_performance_test/factories/resources/session.py index 0beab5bc..652196ba 100644 --- a/src/edfi-performance-test/edfi_performance_test/factories/resources/session.py +++ b/src/edfi-performance-test/edfi_performance_test/factories/resources/session.py @@ -27,6 +27,8 @@ class SessionFactory(APIFactory): "GradingPeriod", "First Six Weeks" ), periodSequence=None, # Must be entered by client + schoolYear=2014, + schoolId=SchoolClient.shared_elementary_school_id(), ) ), ), @@ -39,6 +41,8 @@ class SessionFactory(APIFactory): "GradingPeriod", "Second Six Weeks" ), periodSequence=None, # Must be entered by client + schoolYear=2014, + schoolId=SchoolClient.shared_elementary_school_id(), ) ), ), diff --git a/src/edfi-performance-test/edfi_performance_test/factories/resources/student.py b/src/edfi-performance-test/edfi_performance_test/factories/resources/student.py index 4655fcd8..421cfcb4 100644 --- a/src/edfi-performance-test/edfi_performance_test/factories/resources/student.py +++ b/src/edfi-performance-test/edfi_performance_test/factories/resources/student.py @@ -19,6 +19,8 @@ RandomDateAttribute, ) +SESSION_NAME = "2016-2017 Fall Semester" + class StudentFactory(APIFactory): studentUniqueId = UniqueIdAttribute() @@ -28,73 +30,9 @@ class StudentFactory(APIFactory): lastSurname = "Jones" generationCodeSuffix = "JR" personalTitlePrefix = "Mr" - hispanicLatinoEthnicity = False birthCity = "Grand Bend" birthCountryDescriptor = build_descriptor("Country", "AG") birthStateAbbreviationDescriptor = build_descriptor("StateAbbreviation", "TX") - addresses = factory.List( - [ - factory.SubFactory( - AddressFactory, - addressTypeDescriptor=build_descriptor("AddressType", "Temporary"), - city="Grand Bend", - postalCode="78834", - streetNumberName="654 Mission Hills", - apartmentRoomSuiteNumber="100", - nameOfCounty="Williston", - ) - ] - ) - electronicMails = factory.List( - [ - dict( - electronicMailAddress="Austin@edficert.org", - electronicMailTypeDescriptor=build_descriptor( - "ElectronicMailType", "Other" - ), - ), - ] - ) - identificationCodes = factory.List( - [ - dict( - identificationCode=704, - assigningOrganizationIdentificationCode="State", - studentIdentificationSystemDescriptor=build_descriptor( - "StudentIdentificationSystem", "State" - ), - ), - ] - ) - studentLanguages = factory.List( - [ - dict( - languageDescriptor=build_descriptor("Language", "Spanish"), - ), - ] - ) - studentLanguageUses = factory.List( - [ - dict( - languageUseDescriptor=build_descriptor("LanguageUse", "Home language"), - ), - ] - ) - studentRaces = factory.List( - [ - dict(raceDescriptor=build_descriptor("Race", "Black - African American")), - ] - ) - telephones = factory.List( - [ - dict( - telephoneNumber="111-222-3333", - telephoneNumberTypeDescriptor=build_descriptor( - "TelephoneNumberType", "Home" - ), - ), - ] - ) class StudentCohortAssociationFactory(APIFactory): @@ -155,6 +93,63 @@ class StudentEducationOrganizationAssociationFactory(APIFactory): ] ) sexDescriptor = build_descriptor("Sex", "Male") + hispanicLatinoEthnicity = True + addresses = factory.List( + [ + factory.SubFactory( + AddressFactory, + addressTypeDescriptor=build_descriptor("AddressType", "Temporary"), + city="Grand Bend", + postalCode="78834", + streetNumberName="654 Mission Hills", + apartmentRoomSuiteNumber="100", + nameOfCounty="Williston", + ) + ] + ) + electronicMails = factory.List( + [ + dict( + electronicMailAddress="Austin@edficert.org", + electronicMailTypeDescriptor=build_descriptor( + "ElectronicMailType", "Other" + ), + ), + ] + ) + studentIdentificationCodes = factory.List( + [ + dict( + identificationCode=704, + assigningOrganizationIdentificationCode="State", + studentIdentificationSystemDescriptor=build_descriptor( + "StudentIdentificationSystem", "State" + ), + ), + ] + ) + languages = factory.List( + [ + dict( + languageDescriptor=build_descriptor("Language", "Spanish"), + ), + ] + ) + races = factory.List( + [ + dict(raceDescriptor=build_descriptor("Race", "Black - African American")), + ] + ) + telephones = factory.List( + [ + dict( + telephoneNumber="111-222-3333", + telephoneNumberTypeDescriptor=build_descriptor( + "TelephoneNumberType", "Home" + ), + ), + ] + ) class StudentParentAssociationFactory(APIFactory): @@ -178,10 +173,8 @@ class StudentProgramAssociationFactory(APIFactory): ) # Prepopulated ed organization programReference = factory.Dict( dict( - programTypeDescriptor=build_descriptor( - "ProgramType", "Gifted and Talented" - ), - programName="Gifted and Talented", + programTypeDescriptor=build_descriptor("ProgramType", ProgramClient.shared_program_name), + programName=ProgramClient.shared_program_name, educationOrganizationId=LocalEducationAgencyClient.shared_education_organization_id(), # Prepopulated ed organization ) ) @@ -198,7 +191,7 @@ class StudentSchoolAssociationFactory(APIFactory): entryDate = RandomDateAttribute() entryGradeLevelDescriptor = build_descriptor("GradeLevel", "First Grade") classOfSchoolYearTypeReference = factory.Dict(dict(schoolYear=2027)) - schoolYear = current_year() + schoolYearTypeReference = factory.Dict(dict(schoolYear=current_year())) entryTypeDescriptor = build_descriptor("EntryType", "Next year school") repeatGradeIndicator = False residencyStatusDescriptor = build_descriptor( @@ -218,8 +211,8 @@ class StudentTitleIPartAProgramAssociationFactory(APIFactory): ) # Prepopulated ed organization programReference = factory.Dict( dict( - programTypeDescriptor=build_descriptor("ProgramType", "Title I Part A"), - programName="Title I Part A", + programTypeDescriptor=build_descriptor("ProgramType", ProgramClient.shared_program_name), + programName=ProgramClient.shared_program_name, educationOrganizationId=LocalEducationAgencyClient.shared_education_organization_id(), # Prepopulated ed organization ) ) @@ -240,8 +233,8 @@ class StudentSpecialEducationProgramAssociationFactory(APIFactory): ) # Prepopulated ed organization programReference = factory.Dict( dict( - programTypeDescriptor=build_descriptor("ProgramType", "Special Education"), - programName="Special Education", + programTypeDescriptor=build_descriptor("ProgramType", ProgramClient.shared_program_name), + programName=ProgramClient.shared_program_name, educationOrganizationId=LocalEducationAgencyClient.shared_education_organization_id(), # Prepopulated ed organization ) ) @@ -259,7 +252,7 @@ class StudentSectionAssociationFactory(APIFactory): schoolId=SchoolClient.shared_elementary_school_id(), schoolYear=current_year(), sectionIdentifier="ELA012017RM555", - sessionName="2016-2017 Fall Semester", + sessionName=SESSION_NAME, ) ) studentReference = factory.Dict( @@ -278,7 +271,7 @@ class StudentSchoolAttendanceEventFactory(APIFactory): dict( schoolId=SchoolClient.shared_elementary_school_id(), # Prepopulated school schoolYear=2014, # Prepopulated schoolYear - sessionName="2016-2017 Fall Semester", # Default value for scenarios, but not in the DB + sessionName=SESSION_NAME, # Default value for scenarios, but not in the DB ) ) studentReference = factory.Dict( @@ -297,7 +290,7 @@ class StudentSectionAttendanceEventFactory(APIFactory): schoolId=SchoolClient.shared_elementary_school_id(), schoolYear=current_year(), sectionIdentifier="ELA012017RM555", - sessionName="2016-2017 Fall Semester", + sessionName=SESSION_NAME, ) ) studentReference = factory.Dict( @@ -336,7 +329,7 @@ class StudentCompetencyObjectiveFactory(APIFactory): ), ) ) - objectiveCompetencyObjectiveReference = factory.Dict( + competencyObjectiveReference = factory.Dict( dict( educationOrganizationId=LocalEducationAgencyClient.shared_education_organization_id(), # Prepopulated ed org objective=None, # Must be entered by the user @@ -357,11 +350,9 @@ class StudentCTEProgramAssociationFactory(APIFactory): ) # Prepopulated student programReference = factory.Dict( dict( + programTypeDescriptor=build_descriptor("ProgramType", ProgramClient.shared_program_name), + programName=ProgramClient.shared_program_name, educationOrganizationId=LocalEducationAgencyClient.shared_education_organization_id(), - programTypeDescriptor=build_descriptor( - "ProgramType", ProgramClient.shared_program_name() - ), - programName=ProgramClient.shared_program_name(), ) ) # Prepopulated program beginDate = RandomDateAttribute() @@ -388,7 +379,7 @@ class StudentGradebookEntryFactory(APIFactory): schoolId=SchoolClient.shared_elementary_school_id(), schoolYear=current_year(), sectionIdentifier="ELA012017RM555", - sessionName="2016-2017 Fall Semester", + sessionName=SESSION_NAME, gradebookEntryTitle="ALG-1 - First Six Weeks - Homework - 20170821", dateAssigned=formatted_date(2, 2), ) @@ -399,7 +390,7 @@ class StudentGradebookEntryFactory(APIFactory): schoolId=SchoolClient.shared_elementary_school_id(), schoolYear=current_year(), sectionIdentifier="ELA012017RM555", - sessionName="2016-2017 Fall Semester", + sessionName=SESSION_NAME, studentUniqueId=111111, beginDate=formatted_date(5, 5), ) @@ -415,11 +406,9 @@ class StudentHomelessProgramAssociationFactory(APIFactory): ) # Prepopulated ed org programReference = factory.Dict( dict( + programTypeDescriptor=build_descriptor("ProgramType", ProgramClient.shared_program_name), + programName=ProgramClient.shared_program_name, educationOrganizationId=LocalEducationAgencyClient.shared_education_organization_id(), - programTypeDescriptor=build_descriptor( - "ProgramType", ProgramClient.shared_program_name() - ), - programName=ProgramClient.shared_program_name(), ) ) # Prepopulated program studentReference = factory.Dict( diff --git a/src/edfi-performance-test/edfi_performance_test/factories/utils.py b/src/edfi-performance-test/edfi_performance_test/factories/utils.py index e21c768e..5ec9317a 100644 --- a/src/edfi-performance-test/edfi_performance_test/factories/utils.py +++ b/src/edfi-performance-test/edfi_performance_test/factories/utils.py @@ -82,6 +82,15 @@ def evaluate(self, instance, step, extra): ) +def random_date_time() -> str: + """ + Returns a random date time between 1/1/1901 and 12/28/2050. Ignores days + of the month past the 28th. + """ + + return f"{random.randint(1901, 2050)}-{str(random.randint(1, 12)).zfill(2)}-{str(random.randint(1, 28)).zfill(2)}T15:00:00Z" + + class RandomSchoolYearAttribute(declarations.BaseDeclaration): """ Returns a random date between 1991 & 2050. diff --git a/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/assessment.py b/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/assessment.py index 533436ba..69b712c7 100644 --- a/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/assessment.py +++ b/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/assessment.py @@ -9,7 +9,7 @@ class AssessmentPipecleanTest(EdFiPipecleanTestBase): - update_attribute_name = "title" + update_attribute_name = "assessmentTitle" update_attribute_value = "AP English 3" diff --git a/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/class_period.py b/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/class_period.py index 541fc91a..7a1af4fe 100644 --- a/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/class_period.py +++ b/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/class_period.py @@ -10,5 +10,6 @@ class ClassPeriodPipecleanTest(EdFiPipecleanTestBase): + # This is an allowed natural key update, which should automatically cascade through the API without error update_attribute_name = "classPeriodName" update_attribute_value = RandomSuffixAttribute("Class Period 01", suffix_length=10) diff --git a/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/competency_objective.py b/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/competency_objective.py index 8f30867b..bebb840a 100644 --- a/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/competency_objective.py +++ b/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/competency_objective.py @@ -9,5 +9,5 @@ class CompetencyObjectivePipecleanTest(EdFiPipecleanTestBase): - update_attribute_name = "objectiveGradeLevelDescriptor" - update_attribute_value = "Twelfth grade" + update_attribute_name = "successCriteria" + update_attribute_value = "ABCxyz" diff --git a/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/descriptors.py b/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/descriptors.py index 4538a5ce..0aab430d 100644 --- a/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/descriptors.py +++ b/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/descriptors.py @@ -16,7 +16,7 @@ class DescriptorPipecleanTestBase(EdFiPipecleanTestBase): def __init__(self, descriptor: str, parent, *args, **kwargs): super(DescriptorPipecleanTestBase, self).__init__(parent, *args, **kwargs) - self.update_attribute_name = "codeValue" + self.update_attribute_name = "description" self.update_attribute_value = random_chars(15) self.namespace = f"{descriptor[0].upper()}{descriptor[1:]}" diff --git a/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/education.py b/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/education.py index 095adc57..c47e668f 100644 --- a/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/education.py +++ b/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/education.py @@ -37,10 +37,7 @@ class EducationOrganizationNetworkAssociationPipecleanTest(EdFiPipecleanTestBase class EducationOrganizationPeerAssociationPipecleanTest(EdFiPipecleanTestBase): def _touch_put_endpoint(self, resource_id, default_attributes): - # This resource has no non-FK data attributes, so we'll update one of those - default_attributes["educationOrganizationReference"][ - "educationOrganizationId" - ] = SchoolClient.shared_elementary_school_id() + # This resource has no non-key attributes, so there is nothing to update self.update(resource_id, **default_attributes) @@ -50,7 +47,7 @@ class EducationServiceCenterPipecleanTest(EdFiPipecleanTestBase): class FeederSchoolAssociationPipecleanTest(EdFiPipecleanTestBase): - update_attribute_name = "beginDate" + update_attribute_name = "endDate" update_attribute_value = formatted_date(7, 4) diff --git a/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/gradebook_entries.py b/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/gradebook_entries.py index 1e572829..74e7dc76 100644 --- a/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/gradebook_entries.py +++ b/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/gradebook_entries.py @@ -10,5 +10,6 @@ class GradebookEntryPipecleanTest(EdFiPipecleanTestBase): + # This is an allowed natural key update update_attribute_name = "dateAssigned" update_attribute_value = formatted_date(3, 3) diff --git a/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/parent.py b/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/parent.py index 000f26c0..e1001861 100644 --- a/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/parent.py +++ b/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/parent.py @@ -10,7 +10,7 @@ class ParentPipecleanTest(EdFiPipecleanTestBase): - update_attribute_name = "parentOtherNames" + update_attribute_name = "otherNames" update_attribute_value = [ { "firstName": "Lexi", diff --git a/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/post_secondary.py b/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/post_secondary.py index 21b93fe2..2ab85765 100644 --- a/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/post_secondary.py +++ b/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/post_secondary.py @@ -3,10 +3,10 @@ # The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0. # See the LICENSE and NOTICES files in the project root for more information. -from edfi_performance_test.factories.descriptors.utils import build_descriptor from edfi_performance_test.tasks.pipeclean.ed_fi_pipeclean_test_base import ( EdFiPipecleanTestBase, ) +import factory class PostSecondaryInstitutionPipecleanTest(EdFiPipecleanTestBase): @@ -15,7 +15,7 @@ class PostSecondaryInstitutionPipecleanTest(EdFiPipecleanTestBase): class PostSecondaryEventPipecleanTest(EdFiPipecleanTestBase): - update_attribute_name = "postSecondaryEventCategoryDescriptor" - update_attribute_value = build_descriptor( - "PostSecondaryEventCategory", "College Degree Received" + update_attribute_name = "postSecondaryInstitutionReference" + update_attribute_value = factory.Dict( + dict(postSecondaryInstitutionId=6000203) ) diff --git a/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/program.py b/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/program.py index 7bcb3d85..b44c6856 100644 --- a/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/program.py +++ b/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/program.py @@ -10,5 +10,5 @@ class ProgramPipecleanTest(EdFiPipecleanTestBase): - update_attribute_name = "programTypeDescriptor" - update_attribute_value = build_descriptor("ProgramType", "Special Education") + update_attribute_name = "programId" + update_attribute_value = "xyz" diff --git a/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/student.py b/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/student.py index 2ac67171..28298ae7 100644 --- a/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/student.py +++ b/src/edfi-performance-test/edfi_performance_test/tasks/pipeclean/student.py @@ -23,7 +23,8 @@ class StudentSchoolAssociationPipecleanTest(EdFiPipecleanTestBase): class StudentPipecleanTest(EdFiPipecleanTestBase): def _touch_put_endpoint(self, resource_id, attrs): - attrs["telephones"][0]["telephoneNumber"] = "111-222-4444" + if "telepphones" in attrs and len(attrs["telephones"]) > 0: + attrs["telephones"][0]["telephoneNumber"] = "111-222-4444" self.update(resource_id, **attrs) @@ -78,8 +79,8 @@ class StudentSectionAttendanceEventPipecleanTest(EdFiPipecleanTestBase): class StudentAcademicRecordPipecleanTest(EdFiPipecleanTestBase): - update_attribute_name = "termDescriptor" - update_attribute_value = build_descriptor("Term", "Spring Semester") + update_attribute_name = "cumulativeAttemptedCredits" + update_attribute_value = 7 class StudentCompetencyObjectivePipecleanTest(EdFiPipecleanTestBase): From 0492e5ed1421e5d5be93c4883fd6b13bcae769ba Mon Sep 17 00:00:00 2001 From: Stephen Fuqua Date: Thu, 15 Jun 2023 13:37:20 -0500 Subject: [PATCH 11/12] Remove unnecessary comment --- .../edfi_performance_test/api/client/session.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/session.py b/src/edfi-performance-test/edfi_performance_test/api/client/session.py index e1663585..a3f74042 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/session.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/session.py @@ -16,8 +16,6 @@ class SessionClient(EdFiAPIClient): dependencies: Dict = {GradingPeriodClient: {}} def create_with_dependencies(self, **kwargs): - # is schoolyear a kwarg? - school_id = kwargs.pop("schoolId", SchoolClient.shared_elementary_school_id()) school_year = kwargs.pop("schoolYear", 2014) From 6f50644977cfe0df85bab57486bdd62be2a82f85 Mon Sep 17 00:00:00 2001 From: Stephen Fuqua Date: Thu, 15 Jun 2023 13:42:07 -0500 Subject: [PATCH 12/12] Remove unnecessary comment --- .../edfi_performance_test/api/client/student.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/student.py b/src/edfi-performance-test/edfi_performance_test/api/client/student.py index 025facde..195c86f1 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/student.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/student.py @@ -91,7 +91,6 @@ class StudentSchoolAssociationClient(EdFiAPIClient): def create_with_dependencies(self, **kwargs): # Create association from student to school school_id = kwargs.pop("schoolId", SchoolClient.shared_elementary_school_id()) - # This is coming back with a function, and we need to call that function student_unique_id = kwargs.pop("student_unique_id", StudentClient.shared_student_id()) assoc_overrides = dict(