Ejemplo n.º 1
0
    def test_generates_correct_url_to_game_with_new_game_pk(self, mock_create_game):
        mock_game = Mock()
        mock_game.pk = 2
        mock_create_game.return_value = mock_game

        new_game_view = NewGameView()
        url = new_game_view.get_redirect_url()

        assert url == reverse('game', kwargs={'game_pk': mock_game.pk})
Ejemplo n.º 2
0
"""
The URL routing for the interface app.
"""
from django.conf.urls import url

from interface.views import GameView, NewGameView, MoveView

urlpatterns = [
    url(r'^/game/new$', NewGameView.as_view(), name='new-game'),
    url(r'^/game/(?P<game_pk>\d+)$', GameView.as_view(), name='game'),
    url(r'^/game/(?P<game_pk>\d+)/move$', MoveView.as_view(), name='move'),
]