diff --git a/tests/debug_app_config.py b/tests/debug_app_config.py index 605593b..a0e1d20 100644 --- a/tests/debug_app_config.py +++ b/tests/debug_app_config.py @@ -6,28 +6,51 @@ DEBUG = True LOG_FILE = 'webapp.log' token_file = tempfile.NamedTemporaryFile(delete=False).name -token_data = """# token | name | organization | email | valid_thru -#042979fa186280|||| -04387cfa186280|Gandalf|Wizards|gandalf@shire.me| -043a81fa186280|Bilbo|Hobbits|bilbo@shire.me| -#04538cfa186280|Gimli|Dwarves|gimli@shire.me| -""" -Path(token_file).write_text(token_data) +Path(token_file).write_text( + """# token | name | organization | email | valid_thru + #042979fa186280|||| + 04387cfa186280|Gandalf|Wizards|gandalf@shire.me| + 043a81fa186280|Bilbo|Hobbits|bilbo@shire.me| + #04538cfa186280|Gimli|Dwarves|gimli@shire.me| + """ +) TOKEN_FILE = str(token_file) SECRET_KEY = 'supersecret' SECURITY_PASSWORD_SALT = 'salty' admin_file = tempfile.NamedTemporaryFile(delete=False).name -admin_data = """# create new super-admin by putting the following data in this file: +Path(admin_file).write_text( +"""# create new super-admin by putting the following data in this file: # username email ldap/password # the third column can either be LDAP, in which case the user will be able to authenticate through LDAP # or if it's not LDAP then it should be the password for the new user which will be stored in the local database # examples: gandalf gandalf@shire.me shadowfax """ -Path(admin_file).write_text(admin_data) +) ADMIN_FILE = str(admin_file) db_file = tempfile.NamedTemporaryFile(delete=False).name -SQLALCHEMY_DATABASE_URI = 'sqlite:///' + str(db_file) \ No newline at end of file +SQLALCHEMY_DATABASE_URI = 'sqlite:///' + str(db_file) + +token_log_file = tempfile.NamedTemporaryFile(delete=False).name +Path(token_log_file).write_text( + """1970-01-01 00:00:12,947 - nfc_log - INFO - Loading tokens + 1970-01-01 00:00:12,961 - nfc_log - DEBUG - Opening control socket + 1970-01-01 00:00:24,259 - nfc_log - INFO - Got connection + 1970-01-01 00:00:28,052 - nfc_log - INFO - Connected to mqtt host with result 0 + 2021-04-17 13:05:09,344 - nfc_log - DEBUG - Control socket opening door + 2021-04-17 13:05:09,346 - nfc_log - INFO - Opening the door + 2021-04-17 13:05:25,684 - nfc_log - DEBUG - Control socket closing door + 2021-04-17 13:05:25,685 - nfc_log - INFO - Closing the door + 2021-04-17 13:08:57,121 - nfc_log - INFO - Valid token 04538cfa186280 of Gandalf + 2021-04-17 13:08:57,123 - nfc_log - INFO - Closing the door + 2021-04-17 13:09:06,207 - nfc_log - INFO - Valid token 04538cfa186280 of Gandalf + 2021-04-17 13:09:06,209 - nfc_log - INFO - Opening the door + 2021-04-17 13:09:09,017 - nfc_log - INFO - Valid token 04538cfa186280 of Gandalf + 2021-04-17 13:09:09,019 - nfc_log - ERROR - Opening the door + 2021-04-17 13:09:43,272 - nfc_log - DEBUG - Reloading tokens + """ +) +NFC_LOG = str(token_log_file) \ No newline at end of file