From 516f7fe299193166ce05f81883477e39af05b484 Mon Sep 17 00:00:00 2001 From: SKairinos Date: Tue, 7 Nov 2023 15:26:56 +0000 Subject: [PATCH] remove postcode --- portal/templates/portal/teach/dashboard.html | 2 +- .../teach/onboarding_organisation_page.py | 11 +++++----- portal/tests/test_class.py | 4 ++-- portal/tests/test_independent_student.py | 7 ++++--- portal/tests/test_organisation.py | 18 ++++++++-------- portal/tests/test_teacher.py | 21 ++++++++++--------- portal/tests/test_teacher_student.py | 5 +++-- portal/tests/test_views.py | 13 ++++++------ portal/views/teacher/dashboard.py | 2 +- 9 files changed, 42 insertions(+), 41 deletions(-) diff --git a/portal/templates/portal/teach/dashboard.html b/portal/templates/portal/teach/dashboard.html index 4f91c5fcd..96a825e90 100644 --- a/portal/templates/portal/teach/dashboard.html +++ b/portal/templates/portal/teach/dashboard.html @@ -59,7 +59,7 @@

Welcome back, {{ user|make_into_username }}
-

Your school: {% if user.new_teacher.school %} {{ user.new_teacher.school.name }} ({{ user.new_teacher.school.postcode }}){% endif %}

+

Your school: {% if user.new_teacher.school %} {{ user.new_teacher.school.name }}{% endif %}

{% if is_admin %}

diff --git a/portal/tests/pageObjects/portal/teach/onboarding_organisation_page.py b/portal/tests/pageObjects/portal/teach/onboarding_organisation_page.py index d0895c014..0e44253bd 100644 --- a/portal/tests/pageObjects/portal/teach/onboarding_organisation_page.py +++ b/portal/tests/pageObjects/portal/teach/onboarding_organisation_page.py @@ -13,13 +13,13 @@ def __init__(self, browser): assert self.on_correct_page("onboarding_organisation_page") - def create_organisation(self, name, password, postcode, country="GB"): - self._create_organisation(name, password, postcode, country) + def create_organisation(self, name, password, country="GB"): + self._create_organisation(name, password, country) return onboarding_classes_page.OnboardingClassesPage(self.browser) - def create_organisation_failure(self, name, password, postcode, country="GB"): - self._create_organisation(name, password, postcode, country) + def create_organisation_failure(self, name, password, country="GB"): + self._create_organisation(name, password, country) return self @@ -28,9 +28,8 @@ def create_organisation_empty(self): return self - def _create_organisation(self, name, password, postcode, country): + def _create_organisation(self, name, password, country): self.browser.find_element(By.ID, "id_name").send_keys(name) - self.browser.find_element(By.ID, "id_postcode").send_keys(postcode) country_element = self.browser.find_element(By.ID, "id_country") select = Select(country_element) select.select_by_value(country) diff --git a/portal/tests/test_class.py b/portal/tests/test_class.py index 6121bd1d1..a2e661ebc 100644 --- a/portal/tests/test_class.py +++ b/portal/tests/test_class.py @@ -309,7 +309,7 @@ def test_create_class_as_admin_for_another_teacher(self): email2, password2 = signup_teacher_directly() teacher2 = Teacher.objects.get(new_user__email=email2) school = create_organisation_directly(email1) - join_teacher_to_organisation(email2, school.name, school.postcode) + join_teacher_to_organisation(email2, school.name) # Check teacher 2 doesn't have any classes page = self.go_to_homepage().go_to_teacher_login_page().login(email2, password2).open_classes_tab() @@ -345,7 +345,7 @@ def test_create_dashboard_non_admin(self): school = create_organisation_directly(email_1) klass_1, class_name_1, access_code_1 = create_class_directly(email_1) create_school_student_directly(access_code_1) - join_teacher_to_organisation(email_2, school.name, school.postcode) + join_teacher_to_organisation(email_2, school.name) klass_2, class_name_2, access_code_2 = create_class_directly(email_2) create_school_student_directly(access_code_2) diff --git a/portal/tests/test_independent_student.py b/portal/tests/test_independent_student.py index 4af7b0562..8b2c5ea54 100644 --- a/portal/tests/test_independent_student.py +++ b/portal/tests/test_independent_student.py @@ -23,15 +23,16 @@ from selenium.webdriver.support.wait import WebDriverWait from portal.forms.error_messages import INVALID_LOGIN_MESSAGE + from .base_test import BaseTest from .pageObjects.portal.home_page import HomePage from .utils.messages import ( + is_email_updated_message_showing, is_email_verified_message_showing, is_indep_student_join_request_received_message_showing, is_indep_student_join_request_revoked_message_showing, - is_student_details_updated_message_showing, - is_email_updated_message_showing, is_password_updated_message_showing, + is_student_details_updated_message_showing, ) @@ -558,7 +559,7 @@ def test_join_class_denied_and_accepted_by_admin(self): admin_email, admin_password1 = signup_teacher_directly() standard_email, _ = signup_teacher_directly() school = create_organisation_directly(admin_email) - join_teacher_to_organisation(standard_email, school.name, school.postcode, is_admin=False) + join_teacher_to_organisation(standard_email, school.name, is_admin=False) # Create class for standard teacher which always accepts external requests klass, class_name, access_code = create_class_directly(standard_email) diff --git a/portal/tests/test_organisation.py b/portal/tests/test_organisation.py index eb676c05f..3bc807843 100644 --- a/portal/tests/test_organisation.py +++ b/portal/tests/test_organisation.py @@ -41,7 +41,7 @@ def test_create_clash(self): HomePage(self.selenium) .go_to_teacher_login_page() .login_no_school(email_2, password_2) - .create_organisation_failure(school.name, password_2, school.postcode) + .create_organisation_failure(school.name, password_2) ) assert page.has_creation_failed() @@ -62,7 +62,7 @@ def test_kick(self): _, _, access_code = create_class_directly(email_1) create_school_student_directly(access_code) - join_teacher_to_organisation(email_2, school.name, school.postcode) + join_teacher_to_organisation(email_2, school.name) self.selenium.get(self.live_server_url) page = HomePage(self.selenium).go_to_teacher_login_page().login(email_1, password_1) @@ -86,7 +86,7 @@ def test_move_classes_and_kick(self): _, _, access_code_2 = create_class_directly(email_2) create_school_student_directly(access_code_2) - join_teacher_to_organisation(email_2, school.name, school.postcode) + join_teacher_to_organisation(email_2, school.name) self.selenium.get(self.live_server_url) page = HomePage(self.selenium).go_to_teacher_login_page().login(email_1, password_1) @@ -114,7 +114,7 @@ def test_leave_organisation(self): _, class_name_2, access_code_2 = create_class_directly(email_2) create_school_student_directly(access_code_2) - join_teacher_to_organisation(email_2, school.name, school.postcode) + join_teacher_to_organisation(email_2, school.name) self.selenium.get(self.live_server_url) page = HomePage(self.selenium).go_to_teacher_login_page().login(email_2, password_2) @@ -139,7 +139,7 @@ def test_toggle_admin(self): school = create_organisation_directly(email_1) _, _, access_code = create_class_directly(email_1) create_school_student_directly(access_code) - join_teacher_to_organisation(email_2, school.name, school.postcode) + join_teacher_to_organisation(email_2, school.name) self.selenium.get(self.live_server_url) page = HomePage(self.selenium).go_to_teacher_login_page().login(email_1, password_1) @@ -164,7 +164,7 @@ def test_disable_2FA(self): school = create_organisation_directly(email_1) _, _, access_code = create_class_directly(email_1) create_school_student_directly(access_code) - join_teacher_to_organisation(email_2, school.name, school.postcode) + join_teacher_to_organisation(email_2, school.name) self.selenium.get(self.live_server_url) page = HomePage(self.selenium).go_to_teacher_login_page().login(email_1, password_1) @@ -193,7 +193,7 @@ def test_edit_details(self): self.selenium.get(self.live_server_url) page = HomePage(self.selenium).go_to_teacher_login_page().login(email, password) - assert page.check_organisation_details({"name": school.name, "postcode": school.postcode}) + assert page.check_organisation_details({"name": school.name}) new_name = "new " + school.name new_postcode = "OX2 6LE" @@ -214,8 +214,8 @@ def test_edit_clash(self): self.selenium.get(self.live_server_url) page = HomePage(self.selenium).go_to_teacher_login_page().login(email_2, password_2) - assert not page.check_organisation_details({"name": school1.name, "postcode": school1.postcode}) + assert not page.check_organisation_details({"name": school1.name}) - page = page.change_organisation_details({"name": school1.name, "postcode": school1.postcode}) + page = page.change_organisation_details({"name": school1.name}) assert page.has_edit_failed() diff --git a/portal/tests/test_teacher.py b/portal/tests/test_teacher.py index eec97dcef..6955b3232 100644 --- a/portal/tests/test_teacher.py +++ b/portal/tests/test_teacher.py @@ -30,14 +30,15 @@ from portal.forms.error_messages import INVALID_LOGIN_MESSAGE from portal.tests.base_test import click_buttons_by_id from portal.tests.test_invite_teacher import WAIT_TIME + from .base_test import BaseTest from .pageObjects.portal.home_page import HomePage from .utils.messages import ( - is_message_showing, - is_email_verified_message_showing, - is_teacher_details_updated_message_showing, is_email_updated_message_showing, + is_email_verified_message_showing, + is_message_showing, is_password_updated_message_showing, + is_teacher_details_updated_message_showing, ) @@ -107,7 +108,7 @@ def test_moved_class_has_correct_permissions_for_students_and_teachers(self): # Create teacher 2 -> class 2 -> student 2 email2, password2 = signup_teacher_directly() - join_teacher_to_organisation(email2, school.name, school.postcode) + join_teacher_to_organisation(email2, school.name) klass2, _, access_code2 = create_class_directly(email2, "Class 2") create_school_student_directly(access_code2) @@ -189,7 +190,7 @@ def test_moved_student_has_access_to_only_new_teacher_games(self): create_school_student_directly(access_code1) email2, password2 = signup_teacher_directly() - join_teacher_to_organisation(email2, school.name, school.postcode) + join_teacher_to_organisation(email2, school.name) klass2, _, access_code2 = create_class_directly(email2, "Class 2") create_school_student_directly(access_code2) @@ -521,7 +522,7 @@ def test_edit_details_non_admin(self): school = create_organisation_directly(email_1) _, _, access_code_1 = create_class_directly(email_1) create_school_student_directly(access_code_1) - join_teacher_to_organisation(email_2, school.name, school.postcode) + join_teacher_to_organisation(email_2, school.name) _, _, access_code_2 = create_class_directly(email_2) create_school_student_directly(access_code_2) @@ -668,7 +669,7 @@ def test_admin_sees_all_school_classes(self): # create non_admin account to join the school # check if they cannot see classes standard_email, standard_password = signup_teacher_directly() - join_teacher_to_organisation(standard_email, school.name, school.postcode) + join_teacher_to_organisation(standard_email, school.name) page = ( self.go_to_homepage().go_to_teacher_login_page().login(standard_email, standard_password).open_classes_tab() @@ -681,7 +682,7 @@ def test_admin_sees_all_school_classes(self): # if the teacher can see the classes admin_email, admin_password = signup_teacher_directly() - join_teacher_to_organisation(admin_email, school.name, school.postcode, is_admin=True) + join_teacher_to_organisation(admin_email, school.name, is_admin=True) page = self.go_to_homepage().go_to_teacher_login_page().login(admin_email, admin_password).open_classes_tab() class_code_field = page.browser.find_element(By.ID, f"class-code-{access_code}") @@ -695,7 +696,7 @@ def test_admin_student_edit(self): student_name, student_password, student_student = create_school_student_directly(access_code) joining_email, joining_password = signup_teacher_directly() - join_teacher_to_organisation(joining_email, school.name, school.postcode, is_admin=True) + join_teacher_to_organisation(joining_email, school.name, is_admin=True) page = ( self.go_to_homepage().go_to_teacher_login_page().login(joining_email, joining_password).open_classes_tab() @@ -755,7 +756,7 @@ def test_make_admin_popup(self): # Non admin teacher joined - make admin should also make a popup - join_teacher_to_organisation(joining_email, school.name, school.postcode) + join_teacher_to_organisation(joining_email, school.name) # refresh the page and scroll to the buttons page.browser.execute_script("location.reload()") diff --git a/portal/tests/test_teacher_student.py b/portal/tests/test_teacher_student.py index 8f7dc0aef..12ac78ec6 100644 --- a/portal/tests/test_teacher_student.py +++ b/portal/tests/test_teacher_student.py @@ -20,6 +20,7 @@ from selenium.webdriver.common.by import By from portal.tests.pageObjects.portal.home_page import HomePage + from .base_test import BaseTest @@ -473,7 +474,7 @@ def test_move_cancel_disambiguate(self): old_teacher_email, password_1 = signup_teacher_directly() email_2, _ = signup_teacher_directly() school = create_organisation_directly(old_teacher_email) - join_teacher_to_organisation(email_2, school.name, school.postcode) + join_teacher_to_organisation(email_2, school.name) _, _, access_code_1 = create_class_directly(old_teacher_email) create_class_directly(email_2) student_name, _, _ = create_school_student_directly(access_code_1) @@ -498,7 +499,7 @@ def test_move(self): email_1, password_1 = signup_teacher_directly() email_2, password_2 = signup_teacher_directly() school = create_organisation_directly(email_1) - join_teacher_to_organisation(email_2, school.name, school.postcode) + join_teacher_to_organisation(email_2, school.name) _, _, access_code_1 = create_class_directly(email_1) create_class_directly(email_2) student_name_1, _, _ = create_school_student_directly(access_code_1) diff --git a/portal/tests/test_views.py b/portal/tests/test_views.py index fb0d07873..cfba21ea6 100644 --- a/portal/tests/test_views.py +++ b/portal/tests/test_views.py @@ -151,8 +151,8 @@ def test_csv(self): def test_organisation_kick_has_correct_permissions(self): teacher2_email, _ = signup_teacher_directly() school = create_organisation_directly(self.email) - join_teacher_to_organisation(self.email, school.name, school.postcode, is_admin=True) - join_teacher_to_organisation(teacher2_email, school.name, school.postcode) + join_teacher_to_organisation(self.email, school.name, is_admin=True) + join_teacher_to_organisation(teacher2_email, school.name) teacher2_id = Teacher.objects.get(new_user__email=teacher2_email).id client = self.login() @@ -599,12 +599,12 @@ def test_delete_account_admin(self): _, _, student = create_school_student_directly(access_code_1) student_user_id = student.new_user.id - join_teacher_to_organisation(email2, school.name, school.postcode) + join_teacher_to_organisation(email2, school.name) _, _, access_code_2 = create_class_directly(email2) create_school_student_directly(access_code_2) - join_teacher_to_organisation(email3, school.name, school.postcode) - join_teacher_to_organisation(email4, school.name, school.postcode) + join_teacher_to_organisation(email3, school.name) + join_teacher_to_organisation(email4, school.name) c = Client() url = reverse("teacher_login") @@ -675,7 +675,6 @@ def test_delete_account_admin(self): # school should be anonymised school = School._base_manager.get(id=school_id) assert school.name != school_name - assert school.postcode == "" assert not school.is_active with pytest.raises(School.DoesNotExist): @@ -691,7 +690,7 @@ def test_logged_in_as_admin_check(self): email1, password1 = signup_teacher_directly() email2, password2 = signup_teacher_directly() school = create_organisation_directly(email1) - join_teacher_to_organisation(email2, school.name, school.postcode) + join_teacher_to_organisation(email2, school.name) teacher1 = Teacher.objects.get(new_user__username=email1) teacher2 = Teacher.objects.get(new_user__username=email2) diff --git a/portal/views/teacher/dashboard.py b/portal/views/teacher/dashboard.py index cc33b700f..8c95dcd22 100644 --- a/portal/views/teacher/dashboard.py +++ b/portal/views/teacher/dashboard.py @@ -92,8 +92,8 @@ def dashboard_teacher_view(request, is_admin): update_school_form = OrganisationForm(user=request.user, current_school=school) update_school_form.fields["name"].initial = school.name - update_school_form.fields["postcode"].initial = school.postcode update_school_form.fields["country"].initial = school.country + update_school_form.fields["county"].initial = school.county invite_teacher_form = InviteTeacherForm()