Exemplo n.º 1
0
    def test_login_page_view_returns_correct_html(self):
        request = HttpRequest()
        response = login_page(request)

        expected_html = render_to_string('mainpage/login.html',
                {'form':LoginForm()})
        self.assertEqual(response.content.decode(), expected_html)
Exemplo n.º 2
0
    def test_login_page_has_required_elements(self):
        response = login_page(HttpRequest())

        self.assertContains(response, '<input id="id_username" name="username" type="text"/>', html=True)
        self.assertContains(response, '<input id="id_password" name="password" type="password"/>', html=True)
        self.assertContains(response, '<input id="id_submit" type="submit" value="Login"/>', html=True)
Exemplo n.º 3
0
 def test_login_page_view_displays_login_form(self):
     response = login_page(HttpRequest())
     login_form = LoginForm()
     
     self.assertContains(response, login_form.as_p())