Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'reports': [
[{'status': 'changed', 'count': 1}]
for i in range(app.app.config['DAILY_REPORTS_CHART_DAYS'])
]
}
dbquery = MockDbQuery(query_data)
mocker.patch.object(app.puppetdb, '_query', side_effect=dbquery.get)
rv = client.get('/daily_reports_chart.json')
result_json = json.loads(rv.data.decode('utf-8'))
assert 'result' in result_json
assert (len(result_json['result']) ==
app.app.config['DAILY_REPORTS_CHART_DAYS'])
day_format = '%Y-%m-%d'
cur_day = datetime.strptime(result_json['result'][0]['day'], day_format)
for day in result_json['result'][1:]:
next_day = datetime.strptime(day['day'], day_format)
assert cur_day < next_day
cur_day = next_day
assert rv.status_code == 200
if os.environ.get('WERKZEUG_RUN_MAIN') is None:
try:
subprocess.Popen([
app.config['DEV_COFFEE_LOCATION'], '-w', '-c',
'-o', 'puppetboard/static/js',
'puppetboard/static/coffeescript'
])
except OSError:
app.logger.error(
'The coffee executable was not found, disabling automatic '
'CoffeeScript compilation'
)
# Start the Flask development server
app.debug = True
app.run(app.config['DEV_LISTEN_HOST'], app.config['DEV_LISTEN_PORT'])