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)
|
return render_template('password.html', password=password)
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/_/_/health', methods=['GET'])
|
||||||
|
@check_redis_alive
|
||||||
|
def health_check():
|
||||||
|
return {}
|
||||||
|
|
||||||
|
|
||||||
@check_redis_alive
|
@check_redis_alive
|
||||||
def main():
|
def main():
|
||||||
app.run(host='0.0.0.0')
|
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
|
snappass.app.config['TESTING'] = True
|
||||||
self.app = snappass.app.test_client()
|
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):
|
def test_preview_password(self):
|
||||||
password = "I like novelty kitten statues!"
|
password = "I like novelty kitten statues!"
|
||||||
key = snappass.set_password(password, 30)
|
key = snappass.set_password(password, 30)
|
||||||
|
|
Loading…
Reference in a new issue