test_apidirectory.py 983 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import unittest
from apidirectory import ApiDirectory


class ApiDirectoryTest(unittest.TestCase):
    client_id = "e06fb405-c58e-4334-b746-dd5969575bf2"
    secret = "G5oT3vL1uK8xS7rO5sJ4nH7bK5iB6hN5jN5dI0nL8tO5bG4tT5"
    scope = "iamgroups"
    token_url = "https://apigw-tst.it.umich.edu/um/inst/oauth2/token"

    def test_constructor(self):
        api = ApiDirectory(self.client_id, self.secret, self.scope, self.token_url);
        self.assertEquals(api.client_id, self.client_id)
        self.assertEquals(api.secret, self.secret)
        self.assertEquals(api.scope, self.scope)
        self.assertEquals(api.token_url, self.token_url)
        self.assertEquals(api.timeout, 10)

    def test_build_header(self):
        api = ApiDirectory(self.client_id, self.secret, self.scope, self.token_url);

        header = api.build_headers()
        map = header
        self.assertEquals(map['x-ibm-client-id'], self.client_id)
        self.assertTrue('authorization' in map)