Skip to content

Commit

Permalink
[tst] unittests
Browse files Browse the repository at this point in the history
  • Loading branch information
grindsa committed Nov 28, 2024
1 parent 2c758e4 commit 40407fe
Show file tree
Hide file tree
Showing 6 changed files with 299 additions and 156 deletions.
3 changes: 1 addition & 2 deletions acme_srv/challenge.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,7 @@ def _config_dns_load(self, config_dic: Dict[str, str]):
self.dns_server_list = json.loads(config_dic['Challenge']['dns_server_list'])
except Exception as err_:
self.logger.warning('Challenge._config_load() dns_server_list failed with error: %s', err_)

if 'dns_validation_pause_timer' in config_dic['Challenge']:
if 'Challenge' in config_dic and 'dns_validation_pause_timer' in config_dic['Challenge']:
try:
self.dns_validation_pause_timer = int(config_dic['Challenge']['dns_validation_pause_timer'])
except Exception as err_:
Expand Down
6 changes: 4 additions & 2 deletions examples/ca_handler/acme_ca_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,10 @@ def _config_account_load(self, config_dic: Dict[str, str]):
self.email = config_dic['CAhandler'].get('acme_account_email', None)

if 'ssl_verify' in config_dic['CAhandler']:
self.ssl_verify = config_dic.getboolean('CAhandler', 'ssl_verify', fallback=False)

try:
self.ssl_verify = config_dic.getboolean('CAhandler', 'ssl_verify', fallback=False)
except Exception as err:
self.logger.error('CAhandler._config_load(): failed to parse ssl_verify: %s', err)
self.logger.debug('CAhandler._config_account_load() ended')

def _config_parameters_load(self, config_dic: Dict[str, str]):
Expand Down
12 changes: 6 additions & 6 deletions examples/db_handler/wsgi_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,14 +437,14 @@ def _db_update_housekeeping(self):
else:
self.cursor.execute('''PRAGMA table_info(housekeeping)''')
for column in self.cursor.fetchall():
if column[1] == 'name' and column[2].lower() == 'varchar(15)':
self.logger.info('alter housekeeping table - change size of the name field to 30')
self.cursor.execute('''ALTER TABLE housekeeping RENAME TO tmp_hk''')
if column[1] == 'name' and column[2].lower() == 'varchar(15)': # pragma: no cover
self.logger.info('alter housekeeping table - change size of the name field to 30') # pragma: no cover
self.cursor.execute('''ALTER TABLE housekeeping RENAME TO tmp_hk''') # pragma: no cover
self.cursor.execute('''
CREATE TABLE "housekeeping" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "name" varchar(30) NOT NULL UNIQUE, "value" text, "modified_at" TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL)
''')
self.cursor.execute('''INSERT INTO housekeeping(id, name, value, modified_at) SELECT id, name, value, modified_at FROM tmp_hk''')
self.cursor.execute('''DROP TABLE tmp_hk''')
''') # pragma: no cover
self.cursor.execute('''INSERT INTO housekeeping(id, name, value, modified_at) SELECT id, name, value, modified_at FROM tmp_hk''') # pragma: no cover
self.cursor.execute('''DROP TABLE tmp_hk''') # pragma: no cover

def _db_update_orders(self):
""" alter orders table """
Expand Down
Loading

0 comments on commit 40407fe

Please sign in to comment.