def test_get_league_points_empty(): pts = None fake_get_league_pts = mock.Mock(return_value = pts) fake_responder = mock.Mock() with mock.patch('scores_db.scores.get_league_points', fake_get_league_pts): options = { '<tla>': 'ABC' } # Run the command scores_db.perform_get_league_points(fake_responder, options) # Assert that the right things were called fake_get_league_pts.assert_called_once_with('ABC') # Check that the right text was output fake_responder.assert_called_once_with('No scores available for team ABC')
def test_get_league_points_empty_yaml(): pts = None fake_get_league_pts = mock.Mock(return_value = pts) fake_responder = mock.Mock() with mock.patch('scores_db.scores.get_league_points', fake_get_league_pts): options = { '<tla>': 'ABC', '--yaml': True } # Run the command scores_db.perform_get_league_points(fake_responder, options) # Assert that the right things were called fake_get_league_pts.assert_called_once_with('ABC') # Check that the right text was output fake_responder.assert_called_once_with(yaml.dump({'points':pts}))