admin.autodiscover() from django.views.generic.base import RedirectView from robots_txt.views import RobotsTextView from cards.views.game_views import ( LobbyView, ) from cards.views.card_views import SubmitCardView, import_cards # from cards.views.cards urlpatterns = patterns('', # Examples: # url(r'^$', 'cah.views.home', name='home'), # url(r'^cah/', include('cah.foo.urls')), # Uncomment the admin/doc line below to enable admin documentation: # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), url(r'^robots.txt$', RobotsTextView.as_view()), url(r'^$', LobbyView.as_view(), name="lobby-view",), url(r'^game/', include('cards.urls')), url(r'^import', import_cards, name="import-cards"), url(r'^submit', SubmitCardView.as_view(), name="submit-card"), url(r'^admin/', include(admin.site.urls)), url(r'^accounts/', include('allauth.urls')), )
def test_inactive_game_not_shown(self): self.game.is_active = False self.game.save() response = LobbyView.as_view()(self.request) self.assertTrue('joinable_game_list' in response.context_data) self.assertEqual(list(response.context_data['joinable_game_list']), [])
def test_game_list(self): response = LobbyView.as_view()(self.request) self.assertTrue('joinable_game_list' in response.context_data) self.assertEqual(response.context_data['joinable_game_list'][0][1], 'Test')
def test_private_game_not_shown(self): self.game.name = 'Private Test' self.game.save() response = LobbyView.as_view()(self.request) self.assertTrue('joinable_game_list' in response.context_data) self.assertEqual(list(response.context_data['joinable_game_list']), [])
def test_basic_response(self): response = LobbyView.as_view()(self.request) self.assertEqual(response.status_code, 200)