From ec59c3c7933428e349ad19fd6d9a8a0f706c32ec Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sun, 23 Nov 2014 00:01:15 -0800 Subject: [PATCH] Added test to validate frontend loads --- homeassistant/test.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/homeassistant/test.py b/homeassistant/test.py index 180eb4cd83a..c141a6a9946 100644 --- a/homeassistant/test.py +++ b/homeassistant/test.py @@ -6,7 +6,7 @@ Provides tests to verify that Home Assistant modules do what they should do. """ # pylint: disable=protected-access,too-many-public-methods - +import re import os import unittest import time @@ -464,6 +464,22 @@ class TestHTTP(unittest.TestCase): """ things to be run when tests are started. """ cls.hass = ensure_homeassistant_started() + def test_get_frontend(self): + """ Tests if we can get the frontend. """ + req = requests.get(_url("")) + + self.assertEqual(200, req.status_code) + + frontendjs = re.search( + r'(?P\/static\/frontend-[A-Za-z0-9]{32}.html)', + req.text).groups(0)[0] + + self.assertIsNotNone(frontendjs) + + req = requests.get(_url(frontendjs)) + + self.assertEqual(200, req.status_code) + def test_api_password(self): """ Test if we get access denied if we omit or provide a wrong api password. """