Ejemplo n.º 1
0
 def test_auth_using_invalid_token(self):
     self._set_body_json({
         'username': '******',
         'auth_token': 'iamnotreallyarobot'
     })
     with self.assertRaises(HTTPError):
         api.auth_token(self.session)
Ejemplo n.º 2
0
 def test_auth_using_token(self):
     self._set_body_json({
         'username': '******',
         'auth_token': 'iamarobot'
     })
     parsed = json.loads(api.auth_token(self.session))
     self.assertTrue('token' in parsed)
     self.assertEquals('impersonator', parsed['user']['username'])
Ejemplo n.º 3
0
 def test_users_put_with_auth_token(self):
     self._set_body_json({
         'roles': [1],
         'username': '******',
         'email': '*****@*****.**',
         'accountid': -1,
         'auth_token': 'iamarobotnoreally'
     })
     parsed = json.loads(api.users_put(1, self.session))
     self.assertEqual('tototherobot', parsed['user']['username'])
     # Try to get a session token for this user
     self._set_body_json({
         'username': '******',
         'auth_token': 'iamarobotnoreally'
     })
     parsed = json.loads(api.auth_token(self.session))
     self.assertTrue('token' in parsed)