예제 #1
0
    def test_start_authenticate_v2(self):
        url = start_authenticate_v2('1111')
        self.assertTrue(url.startswith('https://www.box.com/api/oauth2/authorize?'))
        query = parse_qs(urlsplit(url).query)
        self.assertDictEqual({
            'response_type': ['code'],
            'client_id': ['1111'],
        }, query)

        url = start_authenticate_v2('1111', state='some_state')
        self.assertTrue(url.startswith('https://www.box.com/api/oauth2/authorize?'))
        query = parse_qs(urlsplit(url).query)
        self.assertDictEqual({
            'response_type': ['code'],
            'client_id': ['1111'],
            'state': ['some_state']
        }, query)

        url = start_authenticate_v2('1111', redirect_uri='https://foo.org?a=b')
        self.assertTrue(url.startswith('https://www.box.com/api/oauth2/authorize?'))
        query = parse_qs(urlsplit(url).query)
        self.assertDictEqual({
            'response_type': ['code'],
            'client_id': ['1111'],
            'redirect_uri': ['https://foo.org?a=b']
        }, query)
예제 #2
0
    def test_start_authenticate_v2(self):
        url = start_authenticate_v2('1111')
        self.assertTrue(
            url.startswith('https://www.box.com/api/oauth2/authorize?'))
        query = parse_qs(urlsplit(url).query)
        self.assertDictEqual(
            {
                'response_type': ['code'],
                'client_id': ['1111'],
            }, query)

        url = start_authenticate_v2('1111', state='some_state')
        self.assertTrue(
            url.startswith('https://www.box.com/api/oauth2/authorize?'))
        query = parse_qs(urlsplit(url).query)
        self.assertDictEqual(
            {
                'response_type': ['code'],
                'client_id': ['1111'],
                'state': ['some_state']
            }, query)

        url = start_authenticate_v2('1111', redirect_uri='https://foo.org?a=b')
        self.assertTrue(
            url.startswith('https://www.box.com/api/oauth2/authorize?'))
        query = parse_qs(urlsplit(url).query)
        self.assertDictEqual(
            {
                'response_type': ['code'],
                'client_id': ['1111'],
                'redirect_uri': ['https://foo.org?a=b']
            }, query)
예제 #3
0
from box import start_authenticate_v2, finish_authenticate_v2
url = start_authenticate_v2('2dytaokzsribrjnulz3q67dvz2aicd6s')
print url