Ejemplo n.º 1
0
 def test_single_use_only(self):
     self.cur.rowcount = 1
     self.cur.fetchone.return_value = (False, True, True)
     self.api.list_devices.return_value = []
     self.assertFalse(account_mgr.admin_token_auth({}, sentinel.username, sentinel.password))
     self.cur.fetchone.return_value = (False, True, False)
     self.api.list_devices.return_value = []
     self.assertTrue(account_mgr.admin_token_auth({}, sentinel.username, sentinel.password))
Ejemplo n.º 2
0
 def test_single_use_only(self):
     self.cur.rowcount = 1
     self.cur.fetchone.return_value = (False, True, True)
     self.api.list_devices.return_value = []
     self.assertFalse(
         account_mgr.admin_token_auth({}, sentinel.username,
                                      sentinel.password))
     self.cur.fetchone.return_value = (False, True, False)
     self.api.list_devices.return_value = []
     self.assertTrue(
         account_mgr.admin_token_auth({}, sentinel.username,
                                      sentinel.password))
Ejemplo n.º 3
0
 def test_bad_credentials(self):
     self.cur.rowcount = 0 
     self.assertFalse(
         account_mgr.admin_token_auth({}, 
                                      sentinel.username, 
                                      sentinel.password)
     )
Ejemplo n.º 4
0
 def test_no_restrictions(self):
     self.cur.rowcount = 1
     self.cur.fetchone.return_value = (False, False, False)
     self.api.list_devices.return_value = []
     self.assertTrue(
         account_mgr.admin_token_auth({}, sentinel.username,
                                      sentinel.password))
Ejemplo n.º 5
0
 def test_no_restrictions(self):
     self.cur.rowcount = 1
     self.cur.fetchone.return_value = (False, False, self.time, False)
     self.api.list_devices.return_value = []
     self.assertTrue(
         account_mgr.admin_token_auth(
             {}, self.user, sentinel.username, sentinel.password)
     )
Ejemplo n.º 6
0
 def test_bad_credentials(self):
     self.cur.rowcount = 0
     self.assertFalse(
         account_mgr.admin_token_auth({}, sentinel.username,
                                      sentinel.password))