def test_get_broadcast_info__broadcast_id_not_found(): broadcast_id = 'XXXXXXXXXXXX' mock_url = ('https://api.periscope.tv/api/v2/accessVideoPublic?' 'broadcast_id={broadcast_id}').format( broadcast_id=broadcast_id) mock_body_file = open('tests/responses/accessVideoPublic.txt', 'r') mock_body = mock_body_file.read() httpretty.register_uri(httpretty.GET, mock_url, mock_body, status=404) pp = Peri() result = pp.get_broadcast_info(broadcast_id) assert result is None
def test_get_broadcast_info(): broadcast_id = '1zqKVWybqeDGB' mock_url = ('https://api.periscope.tv/api/v2/accessVideoPublic?' 'broadcast_id={broadcast_id}').format( broadcast_id=broadcast_id) mock_body_file = open('tests/responses/accessVideoPublic.txt', 'r') mock_body = mock_body_file.read() httpretty.register_uri(httpretty.GET, mock_url, mock_body) pp = Peri() result = pp.get_broadcast_info(broadcast_id) assert result['id'] == broadcast_id assert result['user_id'] == '376827' assert result['username'] == 'george_clinton'