Added tests

This commit is contained in:
2021-03-07 14:58:01 +00:00
parent 5d4a4b61b6
commit cccc048a92
3 changed files with 42 additions and 2 deletions

View File

@@ -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__':