def test_create_duplicate(self):
        email, password = signup_teacher_directly()
        create_organisation_directly(email)
        _, class_name, access_code = create_class_directly(email)

        student_name = 'bob'

        selenium.get(self.live_server_url)
        page = HomePage(selenium).go_to_login_page().login_no_students(email, password)

        page = page.type_student_name(student_name).type_student_name(student_name).create_students_failure()
        assert page.adding_students_failed()
        assert page.duplicate_students(student_name)
    def test_create_already_exists(self):
        email, password = signup_teacher_directly()
        org_name, postcode = create_organisation_directly(email)
        _, class_name, access_code = create_class_directly(email)
        student_name, student_password, _ = create_school_student_directly(access_code)

        self.browser.get(self.live_server_url)
        page = HomePage(self.browser).go_to_teach_page().login(email, password)
        page = page.go_to_classes_page().go_to_class_page(class_name)
        assert page.has_students()
        assert page.student_exists(student_name)

        page = page.type_student_name(student_name).create_students_failure()
        assert self.is_class_page(page)
        assert page.adding_students_failed()
        assert page.student_already_existed(student_name)
        assert page.has_students()
        assert page.student_exists(student_name)
    def test_create_already_exists(self):
        email, password = signup_teacher_directly()
        org_name, postcode = create_organisation_directly(email)
        _, class_name, access_code = create_class_directly(email)
        student_name, student_password, _ = create_school_student_directly(
            access_code)

        selenium.get(self.live_server_url)
        page = HomePage(selenium).go_to_teach_page().login(email, password)
        page = page.go_to_classes_page().go_to_class_page(class_name)
        assert page.has_students()
        assert page.student_exists(student_name)

        page = page.type_student_name(student_name).create_students_failure()
        assert self.is_class_page(page)
        assert page.adding_students_failed()
        assert page.student_already_existed(student_name)
        assert page.has_students()
        assert page.student_exists(student_name)
    def test_create_duplicate(self):
        email, password = signup_teacher_directly()
        org_name, postcode = create_organisation_directly(email)
        _, class_name, access_code = create_class_directly(email)

        student_name = 'bob'

        self.browser.get(self.live_server_url)
        page = HomePage(self.browser).go_to_teach_page().login(email, password)
        page = page.go_to_classes_page().go_to_class_page(class_name)
        assert page.does_not_have_students()
        assert page.student_does_not_exist(student_name)

        page = page.type_student_name(student_name).type_student_name(student_name).create_students_failure()
        assert self.is_class_page(page)
        assert page.adding_students_failed()
        assert page.duplicate_students(student_name)
        assert page.does_not_have_students()
        assert page.student_does_not_exist(student_name)
    def test_create_duplicate(self):
        email, password = signup_teacher_directly()
        org_name, postcode = create_organisation_directly(email)
        _, class_name, access_code = create_class_directly(email)

        student_name = 'bob'

        selenium.get(self.live_server_url)
        page = HomePage(selenium).go_to_teach_page().login(email, password)
        page = page.go_to_classes_page().go_to_class_page(class_name)
        assert page.does_not_have_students()
        assert page.student_does_not_exist(student_name)

        page = page.type_student_name(student_name).type_student_name(
            student_name).create_students_failure()
        assert self.is_class_page(page)
        assert page.adding_students_failed()
        assert page.duplicate_students(student_name)
        assert page.does_not_have_students()
        assert page.student_does_not_exist(student_name)