diff options
author | Hector Fernandez <hector@iatec.biz> | 2020-07-01 10:45:34 +0200 |
---|---|---|
committer | Hector Fernandez <hector@iatec.biz> | 2020-07-01 10:45:34 +0200 |
commit | 34df86b37d6838b115e65e5f3a332344afeb86b8 (patch) | |
tree | 946e1d7d6d55a4339e453c84c4fbbf4b785a1712 /test-cli/test/helpers/testsrv_db.py | |
parent | 9ac8a326412b04e4873b883c2f2a056ca0b22480 (diff) | |
download | board-34df86b37d6838b115e65e5f3a332344afeb86b8.zip board-34df86b37d6838b115e65e5f3a332344afeb86b8.tar.gz board-34df86b37d6838b115e65e5f3a332344afeb86b8.tar.bz2 |
Changes to adapt to new way to save results in DB. Created audio test. Added protections against unexpected status in DB.
Diffstat (limited to 'test-cli/test/helpers/testsrv_db.py')
-rw-r--r-- | test-cli/test/helpers/testsrv_db.py | 44 |
1 files changed, 17 insertions, 27 deletions
diff --git a/test-cli/test/helpers/testsrv_db.py b/test-cli/test/helpers/testsrv_db.py index 637d45c..7eeefb3 100644 --- a/test-cli/test/helpers/testsrv_db.py +++ b/test-cli/test/helpers/testsrv_db.py @@ -91,8 +91,8 @@ class TestSrv_Database(object): # print(r) return None - def finish_test(self, testid_ctl, testid, newstatus): - sql = "SELECT isee.f_finish_test({},{},'{}')".format(testid_ctl, testid, newstatus) + def finish_test(self, testid_ctl, testid, newstatus, textresult): + sql = "SELECT isee.f_finish_test({},{},'{}','{}')".format(testid_ctl, testid, newstatus, textresult) # print('>>>' + sql) try: self.__sqlObject.db_execute_query(sql) @@ -101,35 +101,13 @@ class TestSrv_Database(object): # print(r) return None - def upload_result_string(self, testid_ctl, testid, descrip, strdata): - sql = "SELECT isee.f_upload_result_string({},{},'{}','{}')".format(testid_ctl, testid, descrip, strdata) - # print('>>>' + sql) - try: - self.__sqlObject.db_execute_query(sql) - except Exception as err: - r = find_between(str(err), '#', '#') - # print(r) - return None - - def upload_result_file(self, testid_ctl, testid, descrip, filepath): + def upload_result_file(self, testid_ctl, testid, desc, filepath, mimetype): try: # generate a new oid fileoid = self.__sqlObject.db_upload_large_file(filepath) # insert into a table - sql = "SELECT isee.f_upload_result_file({},{},'{}','{}')".format(testid_ctl, testid, descrip, fileoid) - # print('>>>' + sql) - self.__sqlObject.db_execute_query(sql) - except Exception as err: - r = find_between(str(err), '#', '#') - # print(r) - return None - - def upload_dmesg(self, testid_ctl, filepath): - try: - # generate a new oid - fileoid = self.__sqlObject.db_upload_large_file(filepath) - # insert into a table - sql = "SELECT isee.f_upload_dmesg_file({},'{}')".format(testid_ctl, fileoid) + sql = "SELECT isee.f_upload_result_file({},{},'{}','{}','{}')".format(testid_ctl, testid, desc, fileoid, + mimetype) # print('>>>' + sql) self.__sqlObject.db_execute_query(sql) except Exception as err: @@ -224,3 +202,15 @@ class TestSrv_Database(object): r = find_between(str(err), '#', '#') # print(r) return None + + def get_setup_variable(self, skey): + sql = "SELECT * FROM admin.get_setupvar('{}')".format(skey) + # print('>>>' + sql) + try: + res = self.__sqlObject.db_execute_query(sql) + # print(res) + return res[0][0] + except Exception as err: + r = find_between(str(err), '#', '#') + # print(r) + return None |