def test_edit_details(self):
        email, password = signup_teacher_directly()

        selenium.get(self.live_server_url)
        page = HomePage(selenium).go_to_teach_page().login(email, password)

        page = page.go_to_account_page()
        page = page.change_teacher_details({
            'title': 'Mrs',
            'first_name': 'Paulina',
            'last_name': 'Koch',
            'current_password': '******',
        })
        assert self.is_teacher_dashboard(page)
        assert is_teacher_details_updated_message_showing(selenium)

        page = page.go_to_account_page()
        assert page.check_account_details({
            'title': 'Mrs',
            'first_name': 'Paulina',
            'last_name': 'Koch',
        })
    def test_edit_details(self):
        email, password = signup_teacher_directly()

        selenium.get(self.live_server_url)
        page = HomePage(selenium).go_to_teach_page().login(email, password)

        page = page.go_to_account_page()
        page = page.change_teacher_details({
            'title': 'Mrs',
            'first_name': 'Paulina',
            'last_name': 'Koch',
            'current_password': '******',
        })
        assert self.is_teacher_dashboard(page)
        assert is_teacher_details_updated_message_showing(selenium)

        page = page.go_to_account_page()
        assert page.check_account_details({
            'title': 'Mrs',
            'first_name': 'Paulina',
            'last_name': 'Koch',
        })
    def test_login_success(self):
        selenium.get(self.live_server_url)
        page = HomePage(selenium)
        page, email, password = signup_teacher(page)
        page = page.login(email, password)
        assert self.is_teacher_dashboard(page)

        page = page.go_to_account_page()
        assert page.check_account_details({
            'title': 'Mr',
            'first_name': 'Test',
            'last_name': 'Teacher',
        })
    def test_login_success(self):
        selenium.get(self.live_server_url)
        page = HomePage(selenium)
        page, email, password = signup_teacher(page)
        page = page.login(email, password)
        assert self.is_teacher_dashboard(page)

        page = page.go_to_account_page()
        assert page.check_account_details({
            'title': 'Mr',
            'first_name': 'Test',
            'last_name': 'Teacher',
        })
    def test_change_email(self):
        email, password = signup_teacher_directly()

        selenium.get(self.live_server_url)
        page = HomePage(selenium).go_to_teach_page().login(email, password)

        page = page.go_to_account_page()
        new_email = '*****@*****.**'
        page = page.change_email(new_email, password)
        assert page.__class__.__name__ == 'EmailVerificationNeededPage'
        assert is_teacher_email_updated_message_showing(selenium)

        page = email_utils.follow_change_email_link_to_teach(page, mail.outbox[0])
        mail.outbox = []

        page = page.login(new_email, password)

        page = page.go_to_account_page()
        assert page.check_account_details({
            'title': 'Mr',
            'first_name': 'Test',
            'last_name': 'Teacher',
        })
    def test_change_email(self):
        email, password = signup_teacher_directly()

        selenium.get(self.live_server_url)
        page = HomePage(selenium).go_to_teach_page().login(email, password)

        page = page.go_to_account_page()
        new_email = '*****@*****.**'
        page = page.change_email(new_email, password)
        assert page.__class__.__name__ == 'EmailVerificationNeededPage'
        assert is_teacher_email_updated_message_showing(selenium)

        page = email_utils.follow_change_email_link_to_teach(
            page, mail.outbox[0])
        mail.outbox = []

        page = page.login(new_email, password)

        page = page.go_to_account_page()
        assert page.check_account_details({
            'title': 'Mr',
            'first_name': 'Test',
            'last_name': 'Teacher',
        })
    def test_change_password(self):
        email, password = signup_teacher_directly()

        selenium.get(self.live_server_url)
        page = HomePage(selenium).go_to_teach_page().login(email, password)

        page = page.go_to_account_page()
        new_password = '******'
        page = page.change_teacher_details({
            'password': new_password,
            'confirm_password': new_password,
            'current_password': password,
        })
        assert self.is_teacher_dashboard(page)
        assert is_teacher_details_updated_message_showing(selenium)

        page = page.logout().go_to_teach_page().login(email, new_password)
        assert self.is_teacher_dashboard(page)
    def test_change_password(self):
        email, password = signup_teacher_directly()

        selenium.get(self.live_server_url)
        page = HomePage(selenium).go_to_teach_page().login(email, password)

        page = page.go_to_account_page()
        new_password = '******'
        page = page.change_teacher_details({
            'password': new_password,
            'confirm_password': new_password,
            'current_password': password,
        })
        assert self.is_teacher_dashboard(page)
        assert is_teacher_details_updated_message_showing(selenium)

        page = page.logout().go_to_teach_page().login(email, new_password)
        assert self.is_teacher_dashboard(page)