コード例 #1
0
ファイル: test_oauth.py プロジェクト: ineffablebob/trakt.py
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')
コード例 #2
0
ファイル: test_oauth.py プロジェクト: shad7/trakt.py
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')
コード例 #3
0
ファイル: test_oauth.py プロジェクト: fuzeman/trakt.py
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')
コード例 #4
0
ファイル: test_oauth.py プロジェクト: lhuriguen/trakt.py
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()
コード例 #5
0
ファイル: test_oauth.py プロジェクト: shad7/trakt.py
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()