def test_post_normal(self, model_tournament, view_tournament): # Setup mock_model = Mock() mock_model.create_new_tournament = Mock() model_tournament.return_value = mock_model mock_view = Mock() mock_view.render = Mock() view_tournament.return_value = mock_view data = { } # Preconditions # Run the test post(None, data) # Postconditions mock_model.create_new_tournament.assert_called_with(8, None) mock_view.render.assert_called_once_with()
def test_post_with_large_num_images(self, model_tournament, view_tournament): # Setup mock_model = Mock() mock_model.create_new_tournament = Mock() model_tournament.return_value = mock_model mock_view = Mock() mock_view.render = Mock() view_tournament.return_value = mock_view data = { 'num_images': 999 } # Preconditions # Run the test post(None, data) # Postconditions mock_model.create_new_tournament.assert_called_with(32, None) mock_view.render.assert_called_once_with()
def test_post_with_a_starting_image_id(self, model_tournament, view_tournament): # Setup mock_model = Mock() mock_model.create_new_tournament = Mock() model_tournament.return_value = mock_model mock_view = Mock() mock_view.render = Mock() view_tournament.return_value = mock_view data = { 'starting_image_id': 888 } # Preconditions # Run the test post(None, data) # Postconditions mock_model.create_new_tournament.assert_called_with(8, 888) mock_view.render.assert_called_once_with()