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))
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))
def test_bad_credentials(self): self.cur.rowcount = 0 self.assertFalse( account_mgr.admin_token_auth({}, sentinel.username, sentinel.password) )
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))
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) )
def test_bad_credentials(self): self.cur.rowcount = 0 self.assertFalse( account_mgr.admin_token_auth({}, sentinel.username, sentinel.password))