def test_should_delegate_to_user_dashboard_if_are_logged_in(self, mock_user_dashboard): request = Mock() request.user.is_authenticated.return_value = True response = front_page_view(request) self.assertCalledOnce(mock_user_dashboard, request) self.assertEquals(response, mock_user_dashboard.return_value)
def test_should_delegate_to_non_logged_in_front_page_view_if_not_logged_in(self, mock_non_logged_in_front_page_view): request = Mock() request.user.is_authenticated.return_value = False response = front_page_view(request) self.assertCalledOnce(mock_non_logged_in_front_page_view, request) self.assertEquals(response, mock_non_logged_in_front_page_view.return_value)