def test_authorize_url(): Trakt.site_url = 'http://mock' with Trakt.configuration.client('mock', 'mock'): assert_url( Trakt['oauth'].authorize_url('urn:ietf:wg:oauth:2.0:oob'), '/oauth/authorize', { 'redirect_uri': 'urn:ietf:wg:oauth:2.0:oob', 'response_type': 'code', 'client_id': 'mock' }) assert_url( Trakt['oauth'].authorize_url('urn:ietf:wg:oauth:2.0:oob', state='state', username='******'), '/oauth/authorize', { 'username': '******', 'state': 'state', 'redirect_uri': 'urn:ietf:wg:oauth:2.0:oob', 'response_type': 'code', 'client_id': 'mock' }) with pytest.raises(ValueError): Trakt['oauth'].authorize_url('urn:ietf:wg:oauth:2.0:oob')
def test_authorize_url(): with Trakt.configuration.client('mock', 'mock'): assert_url(Trakt['oauth'].authorize_url('urn:ietf:wg:oauth:2.0:oob'), '/oauth/authorize', { 'redirect_uri': 'urn:ietf:wg:oauth:2.0:oob', 'response_type': 'code', 'client_id': 'mock' }) assert_url(Trakt['oauth'].authorize_url('urn:ietf:wg:oauth:2.0:oob', state='state', username='******'), '/oauth/authorize', { 'username': '******', 'state': 'state', 'redirect_uri': 'urn:ietf:wg:oauth:2.0:oob', 'response_type': 'code', 'client_id': 'mock' }) with pytest.raises(ValueError): Trakt['oauth'].authorize_url('urn:ietf:wg:oauth:2.0:oob')
def test_authorize_url(): Trakt.site_url = 'http://mock' assert_url(Trakt['oauth'].authorize_url('urn:ietf:wg:oauth:2.0:oob'), '/oauth/authorize', { 'redirect_uri': 'urn:ietf:wg:oauth:2.0:oob', 'response_type': 'code', 'client_id': 'mock-client_id' }) assert_url( Trakt['oauth'].authorize_url('urn:ietf:wg:oauth:2.0:oob', state='state', username='******'), '/oauth/authorize', { 'username': '******', 'state': 'state', 'redirect_uri': 'urn:ietf:wg:oauth:2.0:oob', 'response_type': 'code', 'client_id': 'mock-client_id' } ) with pytest.raises(ValueError): TraktClient()['oauth'].authorize_url('urn:ietf:wg:oauth:2.0:oob')
def test_pin_url(): with Trakt.configuration.app(id=1234): assert_url(Trakt['oauth'].pin_url(), '/pin/1234') with pytest.raises(ValueError): Trakt['oauth'].pin_url()