diff --git a/snappass/main.py b/snappass/main.py index 50b51f0..0568154 100644 --- a/snappass/main.py +++ b/snappass/main.py @@ -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') diff --git a/tests.py b/tests.py index 1c385f9..b92eeeb 100644 --- a/tests.py +++ b/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)