def test_getRID_works(self): # Ensure that getRID() works as expected. timestamp = str(datetime.datetime.now()) new_timestamp = timestamp.replace(":", "") with self.client: self.client.post( '/login', data=dict(email="*****@*****.**", password="******"), follow_redirects=True ) self.client.post( '/dashboard/reactions/enotify', data=dict(name=new_timestamp, trigger=1, frequency=1, email="*****@*****.**", send_true=True), follow_redirects=True ) user = User() user_id = user.getUID('*****@*****.**', g.rdb_conn) get_reaction_id = Reaction() response = get_reaction_id.getRID( new_timestamp+':'+user_id, g.rdb_conn) results = r.table('reactions').filter( {'name': new_timestamp}).run(g.rdb_conn) for result in results: reaction_id = result['id'] break self.assertEqual(response, reaction_id)