Fakultas Ilmu Komputer UI

Commit 64d14dec authored by emil farisan's avatar emil farisan
Browse files

Exercise 8

parent 86418e9b
from django.contrib.auth.views import logout
from django.conf.urls import url
from accounts import views
urlpatterns = [
url(r'^send_login_email$', views.send_login_email, name='send_login_email'),
url(r'^login$', views.login, name='login'),
url(r'^logout$', logout, {'next_page': '/'}, name='logout'),
]
\ No newline at end of file
...@@ -41,8 +41,18 @@ class LoginTest(FunctionalTest): ...@@ -41,8 +41,18 @@ class LoginTest(FunctionalTest):
self.browser.get(url) self.browser.get(url)
# she is logged in! # she is logged in!
self.wait_for( self.wait_for(
lambda: self.browser.find_element_by_link_text('Log out') lambda: self.browser.find_element_by_link_text('Log out')
) )
navbar = self.browser.find_element_by_css_selector('.navbar') navbar = self.browser.find_element_by_css_selector('.navbar')
self.assertIn(TEST_EMAIL, navbar.text) self.assertIn(TEST_EMAIL, navbar.text)
\ No newline at end of file
# Now she logs out
self.browser.find_element_by_link_text('Log out').click()
# She is logged out
self.wait_for(
lambda: self.browser.find_element_by_name('email')
)
navbar = self.browser.find_element_by_css_selector('.navbar')
self.assertNotIn(TEST_EMAIL, navbar.text)
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment