def test_add_js_info_to_db(self): js_info_id = dbu.add_js_info_to_db(self.domainInfo, self.db_conn, 123) # 123 a a fake site_info_id js_info = dbu.get_js_info_from_db(self.db_conn, by='id', value=js_info_id)[0] self.assert_db_val_equal(js_info, 'rank', self.domainInfo.rank) self.assert_db_val_equal(js_info, 'num_offsetHeight_calls', self.domainInfo.num_offsetHeight_calls) self.assert_db_val_equal(js_info, 'num_offsetWidth_calls', self.domainInfo.num_offsetWidth_calls) self.assert_db_val_equal(js_info, 'fpd_logs', ','.join(self.domainInfo.fpd_logs))
def insert_js_info_to_db(domaInfo, site_info_id, db_conn): dbu.add_js_info_to_db(domaInfo, db_conn, site_info_id)
def insert_domain_info_to_db(domaInfo): db_conn = dbu.mysql_init_db() site_info_id = dbu.add_site_info_to_db(domaInfo, db_conn) dbu.add_js_info_to_db(domaInfo, db_conn, site_info_id) db_conn.commit() db_conn.close()