Exemplo n.º 1
0
    def test_before_elections(self):
        """Assert that before elections the front page renders itself."""
        from nuvavaalit.models import Schedule
        from nuvavaalit.views.public import home

        request = testing.DummyRequest(statsd=False)
        self.assertTrue(Schedule(request).before_elections())
        self.assertEquals(home(request), {
            'browse_url': 'http://example.com/ehdokkaat'})
Exemplo n.º 2
0
    def test_during_elections(self):
        """Assert that during elections the front page redirects to the login page."""
        from nuvavaalit.models import Schedule
        from nuvavaalit.views.public import home

        request = testing.DummyRequest(statsd=False)
        self.assertTrue(Schedule(request).during_elections())
        response = home(request)
        self.assertEquals(response.status, '302 Found')
        self.assertEquals(response.location, 'http://example.com/tunnistaudu')