def test_parse_strace_logs(self): lso_events = lso.parse_strace_logs(self.vi, test_lso=self.lso_file) self.assertEqual(len(lso_events), 1) lso_event = lso_events[0] self.assertEqual(lso_event.js_line, "") self.assertEqual(lso_event.log_text, TEST_LSO_VALUE) self.assertEqual(lso_event.initiator, cm.ONLINE_TEST_HOST) self.assertEqual(lso_event.js_file, TEST_LSO_FILENAME) self.assertEqual(lso_event.cookie_path, TEST_LSO_REL_PATH)
def test_lso_db_ops(self): lso_events = lso.parse_strace_logs(self.vi, test_lso=self.lso_file) dbu.insert_to_db(dbu.DBCmd.ADD_LSO_ITEMS, lso_events, self.vi) lso_items_db = dbu.get_db_entry(self.vi.out_db, dbu.DBCmd.GET_FLASH_COOKIES, self.vi.visit_id).fetchall() self.assertEqual(len(lso_items_db), 1) lso_event = lso_items_db[0] page_url, domain, filename, local_path, key, content = lso_event[2:8] self.assertEqual(page_url, self.vi.url) self.assertEqual(domain, cm.ONLINE_TEST_HOST) self.assertEqual(filename, TEST_LSO_FILENAME) self.assertEqual(local_path, TEST_LSO_REL_PATH) self.assertEqual(key, TEST_LSO_KEYNAME) self.assertEqual(content, TEST_LSO_VALUE)