Ignore:
Timestamp:
Apr 10, 2020, 5:40:18 PM (7 years ago)
Author:
Joachim Langenbach <joachim.langenbach@…>
Branches:
debian/bullseye, master
Children:
5c9c247
Parents:
ce59b61
Message:
  • Fixed testing environment
    • Fixed some issues in the API and it's serving
Location:
src/mapservice/server_impl/demo
Files:
2 moved

Legend:

Unmodified
Added
Removed
  • src/mapservice/server_impl/demo/DbSetup.py

    rce59b61 rae2ff15  
    2626        db_setup()
    2727       
    28         print("CREATING DATABASE TEST CONTENT...")
     28        print("CREATING DATABASE DEMO CONTENT...")
    2929        with db.session.no_autoflush:
    3030                test_user_john = None
    … …  
    5050                        db.session.add(test_user_jane)
    5151                        db.session.commit()
    52                
     52                       
    5353                if len(ApiKey.query.filter_by(key='DelApiKey4711').all()) < 1:
    5454                        db.session.add(ApiKey(user=test_user_jane, key='DelApiKey4711'))
    5555                        db.session.commit()
    56                 if len(ApiKey.query.filter_by(key='test_key').all()) < 1:
    57                         db.session.add(ApiKey(user=test_user_jane, key='test_key'))
    58                         db.session.commit()
    59                 if len(ApiKey.query.filter_by(key='ApiKey4712').all()) < 1:
    60                         db.session.add(ApiKey(user=test_user_jane, key='ApiKey4712'))
     56                if len(ApiKey.query.filter_by(key='test_key_jane').all()) < 1:
     57                        db.session.add(ApiKey(user=test_user_jane, key='test_key_jane'))
    6158                        db.session.commit()
    6259               
    … …  
    126123def _sample_log_add(water, gauge, gauge_height, device, submitter, log_file):
    127124        if len(Log.query.filter_by(submitter=submitter).all()) > 0:
    128                 return
    129        
    130         if not 'CELERY_BROKER_URL' in flask.current_app.config or not flask.current_app.config['CELERY_BROKER_URL']:
    131                 print('Do not add log, since their is no CELERY_BROKER_URL configured')
    132                 return
     125                return None
    133126       
    134127        log = Log(submitter=submitter, water=water, device=device, gauge=gauge, gauge_height=0, comment='Demo Log from {}'.format(log_file))
    135128        db.session.add(log)
    136129        db.session.commit()
     130       
     131        if not 'CELERY_BROKER_URL' in flask.current_app.config or not flask.current_app.config['CELERY_BROKER_URL']:
     132                print('Do not add log, since their is no CELERY_BROKER_URL configured')
     133                return log
    137134       
    138135        with open(log_file, 'r') as logfile:
    … …  
    152149        # request log parsing
    153150        log_process.delay(log.id, data)
     151        return log
Note: See TracChangeset for help on using the changeset viewer.