def test_refresh_tokens(): gp = pigskin() # login login_success = gp.login(username=pytest.gp_username, password=pytest.gp_password) assert login_success == True # make sure tokens are actually set assert gp.access_token != '' assert gp.refresh_token != '' # store the initial tokens first_access_token = gp.access_token first_refresh_token = gp.refresh_token # refresh the tokens refresh_success = gp.refresh_tokens() assert refresh_success == True # make sure new tokens are actually set assert gp.access_token != '' assert gp.refresh_token != '' # and finally make sure they've actually been refreshed assert first_access_token != gp.access_token assert first_refresh_token != gp.refresh_token
def test_get_redzone_streams_failure(): gp = pigskin() assert gp.login(username=pytest.gp_username, password=pytest.gp_password) streams = gp._video.get_redzone_streams() # make sure we don't have a response assert not streams
def test_get_nfl_network_streams(): gp = pigskin() assert gp.login(username=pytest.gp_username, password=pytest.gp_password) streams = gp._video.get_nfl_network_streams() # make sure we have responses assert streams # and check that there's actual links provided for f in ['hls', 'chromecast', 'connecttv']: assert 'https://' in streams[f]
import pytest import requests from pigskin.pigskin import pigskin gp = pigskin() # These tests are just to make sure that the logging doesn't blow up. There's no # need to test the output, just that it doesn't fail. @pytest.mark.vcr() def test_response_json(): r = requests.get('https://httpbin.org/json') result = gp._log_request(r) assert result == True @pytest.mark.vcr() def test_response_html(): r = requests.get('https://httpbin.org/html') result = gp._log_request(r) assert result == True @pytest.mark.vcr() def test_response_bytes(): r = requests.get('https://httpbin.org/bytes/20') result = gp._log_request(r) assert result == True def test_empty_handlel(): result = gp._log_request(None)
def gp(): with vcr.use_cassette('backends/europe/gp.yaml'): return pigskin()
def gp(): with vcr.use_cassette('public_API/europe_gp.yaml'): return pigskin()
def test_login_success(): gp = pigskin() result = gp.login(username=pytest.gp_username, password=pytest.gp_password) assert result == True
def test_login_failure(): gp = pigskin() result = gp.login(username='******', password='******') assert result == False