Add health check endpoint (#329)
* Add health check endpoint * Add assertion on status
This commit is contained in:
parent
74ded4156b
commit
455db36189
2 changed files with 11 additions and 0 deletions
|
@ -202,6 +202,12 @@ def show_password(password_key):
|
|||
return render_template('password.html', password=password)
|
||||
|
||||
|
||||
@app.route('/_/_/health', methods=['GET'])
|
||||
@check_redis_alive
|
||||
def health_check():
|
||||
return {}
|
||||
|
||||
|
||||
@check_redis_alive
|
||||
def main():
|
||||
app.run(host='0.0.0.0')
|
||||
|
|
5
tests.py
5
tests.py
|
@ -106,6 +106,11 @@ class SnapPassRoutesTestCase(TestCase):
|
|||
snappass.app.config['TESTING'] = True
|
||||
self.app = snappass.app.test_client()
|
||||
|
||||
def test_health_check(self):
|
||||
response = self.app.get('/_/_/health')
|
||||
self.assertEqual('200 OK', response.status)
|
||||
self.assertEqual('{}', response.get_data(as_text=True).strip())
|
||||
|
||||
def test_preview_password(self):
|
||||
password = "I like novelty kitten statues!"
|
||||
key = snappass.set_password(password, 30)
|
||||
|
|
Loading…
Reference in a new issue