Skip to content

Commit

Permalink
remove postcode
Browse files Browse the repository at this point in the history
  • Loading branch information
SKairinos committed Nov 7, 2023
1 parent 4dbea51 commit 516f7fe
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 41 deletions.
2 changes: 1 addition & 1 deletion portal/templates/portal/teach/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ <h1 class="banner__text--primary">Welcome back, {{ user|make_into_username }}</h
<div id="school" class="tab-pane active">
<div class="background container">
<section>
<h4>Your school: {% if user.new_teacher.school %} {{ user.new_teacher.school.name }} ({{ user.new_teacher.school.postcode }}){% endif %}</h4>
<h4>Your school: {% if user.new_teacher.school %} {{ user.new_teacher.school.name }}{% endif %}</h4>
</section>
{% if is_admin %}
<p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions portal/tests/test_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)

Expand Down
7 changes: 4 additions & 3 deletions portal/tests/test_independent_student.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)


Expand Down Expand Up @@ -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)
Expand Down
18 changes: 9 additions & 9 deletions portal/tests/test_organisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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"
Expand All @@ -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()
21 changes: 11 additions & 10 deletions portal/tests/test_teacher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)


Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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()
Expand All @@ -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}")
Expand All @@ -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()
Expand Down Expand Up @@ -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()")
Expand Down
5 changes: 3 additions & 2 deletions portal/tests/test_teacher_student.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
13 changes: 6 additions & 7 deletions portal/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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):
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion portal/views/teacher/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit 516f7fe

Please sign in to comment.