

def testRenewAuthToken(self):
    assert (self.client.get_session_token() == b'')
    client = pyorient.OrientDB('localhost', 2424)
    client.set_session_token(True)
    client.db_open('GratefulDeadConcerts', 'admin', 'admin')
    res1 = client.record_load('#9:1')
    res2 = client.query('select from V where @rid = #9:1')
    self.assertEqual(res1.oRecordData['name'], res2[0].oRecordData['name'])
    self.assertEqual(res1.oRecordData['out_sung_by'].get_hash(), res2[0].oRecordData['out_sung_by'].get_hash())
    self.assertEqual(res1.oRecordData['out_written_by'].get_hash(), res2[0].oRecordData['out_written_by'].get_hash())
    actual_token = client.get_session_token()
    del client
    client = pyorient.OrientDB('localhost', 2424)
    client.set_session_token(actual_token)
    res3 = client.query('select from V where @rid = #9:1')
    self.assertEqual(res2[0].oRecordData['name'], res3[0].oRecordData['name'])
    self.assertEqual(res2[0].oRecordData['out_sung_by'].get_hash(), res3[0].oRecordData['out_sung_by'].get_hash())
    self.assertEqual(res2[0].oRecordData['out_written_by'].get_hash(), res3[0].oRecordData['out_written_by'].get_hash())
    client.set_session_token(True)
    client.db_open('GratefulDeadConcerts', 'admin', 'admin')
    global old_token
    self.assertNotEqual(old_token, actual_token)
    self.assertNotEqual(old_token, client.get_session_token())
    self.assertNotEqual(actual_token, client.get_session_token())

dataset/ETHPy150Open mogui/pyorient/tests/test_token_auth.py TokenAuthTest.testRenewAuthToken/original