diff --git a/src/meshapi/tests/test_join_form.py b/src/meshapi/tests/test_join_form.py index e7d1975b..d564dc67 100644 --- a/src/meshapi/tests/test_join_form.py +++ b/src/meshapi/tests/test_join_form.py @@ -265,6 +265,29 @@ def test_valid_join_form_with_member_confirmation(self, submission): ) validate_successful_join_form_submission(self, "Valid Join Form", s, response) + def test_phone_number_is_silently_corrected(self): + self.requests_mocker.get( + NYC_PLANNING_LABS_GEOCODE_URL, + json=valid_join_form_submission["dob_addr_response"], + ) + + request, s = pull_apart_join_form_submission(valid_join_form_submission) + + request["phone_number"] = "+1 585-75 8-3425" + request["trust_me_bro"] = False + + response = self.c.post("/api/v1/join/", request, content_type="application/json") + code = 201 + self.assertEqual( + code, + response.status_code, + f"status code incorrect for Valid Join Form. Should be {code}, but got {response.status_code}.\n Response is: {response.content.decode('utf-8')}", + ) + validate_successful_join_form_submission(self, "Valid Join Form", s, response) + + member = Member.objects.get(installs__install_number=response.json()["install_number"]) + self.assertEqual(member.phone_number, "+1 585-758-3425") + def test_valid_join_form_aussie_intl_phone(self): request, s = pull_apart_join_form_submission(valid_join_form_submission) diff --git a/src/meshapi/views/forms.py b/src/meshapi/views/forms.py index 3e298891..397fd3de 100644 --- a/src/meshapi/views/forms.py +++ b/src/meshapi/views/forms.py @@ -185,10 +185,6 @@ def process_join_form(r: JoinFormRequest, request: Optional[Request] = None) -> changed_info: dict[str, str | int] = {} - if formatted_phone_number and r.phone_number != formatted_phone_number: - logging.warning(f"Changed phone_number: {formatted_phone_number} != {r.phone_number}") - changed_info["phone_number"] = formatted_phone_number - if r.street_address != nyc_addr_info.street_address: logging.warning(f"Changed street_address: {r.street_address} != {nyc_addr_info.street_address}") changed_info["street_address"] = nyc_addr_info.street_address