コード例 #1
0
class TestBasicAuthentication(unittest.TestCase):
    def setUp(self):
        self.auth = BasicAuthentication('USERNAME', 'APIKEY')

    def test_attribs(self):
        self.assertEquals(self.auth.username, 'USERNAME')
        self.assertEquals(self.auth.api_key, 'APIKEY')

    def test_get_headers(self):
        self.assertEquals(self.auth.get_headers(), {
            'authenticate': {
                'username': '******',
                'apiKey': 'APIKEY',
            }
        })

    def test_repr(self):
        s = repr(self.auth)
        self.assertIn('BasicAuthentication', s)
        self.assertIn('USERNAME', s)
コード例 #2
0
 def setUp(self):
     self.auth = BasicAuthentication('USERNAME', 'APIKEY')