Added tests
This commit is contained in:
@@ -73,7 +73,7 @@ def main(config, log):
|
||||
if does_file_exist(config['message_sent_file']):
|
||||
log.info(
|
||||
f'Already had positive result, remove {config["message_sent_file"]} to allow script to run again')
|
||||
return
|
||||
raise StopIteration('Already run once')
|
||||
|
||||
json = get_json_from_url(config['api_url'])
|
||||
|
||||
@@ -81,6 +81,7 @@ def main(config, log):
|
||||
if id['edp'] == config['item_id']:
|
||||
if id['stockStatus'] == 'OutOfStock':
|
||||
log.info("Item is out of stock")
|
||||
return False
|
||||
else:
|
||||
log.info("Item is in stock")
|
||||
send_sms(
|
||||
@@ -88,6 +89,7 @@ def main(config, log):
|
||||
|
||||
# Prevents it being run again
|
||||
create_file(config['message_sent_file'])
|
||||
return True
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user