summaryrefslogtreecommitdiff
path: root/service/test/unit
diff options
context:
space:
mode:
authorAnike Arni <aarni@thoughtworks.com>2017-02-16 18:51:26 -0200
committerAnike Arni <aarni@thoughtworks.com>2017-02-16 18:51:26 -0200
commit957599ae01687d6b3d02a3c34fdbe2ac6bd920f9 (patch)
tree7612fa7cfd33bd9657bce0eb9e8db47b076cedcc /service/test/unit
parent64780114ae90bb890d3ffa0a9aebe4686c6b74d3 (diff)
[#907] Bundles login static files separately
Due to conflicts with public and protected urls, login and interstitial files have to be on a different public url from inbox and resources that require login. Therefore, here, we delegate that logic to webpack. Now we have a '/public' url and a '/assets' url for those static assets.
Diffstat (limited to 'service/test/unit')
-rw-r--r--service/test/unit/resources/test_helpers.py7
-rw-r--r--service/test/unit/resources/test_login_resource.py2
2 files changed, 8 insertions, 1 deletions
diff --git a/service/test/unit/resources/test_helpers.py b/service/test/unit/resources/test_helpers.py
index e21c5373..6c456f51 100644
--- a/service/test/unit/resources/test_helpers.py
+++ b/service/test/unit/resources/test_helpers.py
@@ -18,6 +18,7 @@ from twisted.trial import unittest
import re
from pixelated.resources import respond_json, respond_json_deferred
+from pixelated.resources import get_public_static_folder, get_protected_static_folder
from test.unit.resources import DummySite
from twisted.web.test.requesthelper import DummyRequest
@@ -44,3 +45,9 @@ class TestHelpers(unittest.TestCase):
self.assertEqual(b"{\"test\": \"yep\"}", request.written[0])
self.assertEqual([b"application/json"],
request.responseHeaders.getRawHeaders("Content-Type"))
+
+ def test_getting_public_folder_returns_path(self):
+ self.assertIn('web-ui/dist/public', get_public_static_folder())
+
+ def test_getting_protected_folder_returns_path(self):
+ self.assertIn('web-ui/dist/protected', get_protected_static_folder())
diff --git a/service/test/unit/resources/test_login_resource.py b/service/test/unit/resources/test_login_resource.py
index 29592c1d..bd0f9122 100644
--- a/service/test/unit/resources/test_login_resource.py
+++ b/service/test/unit/resources/test_login_resource.py
@@ -230,7 +230,7 @@ class TestLoginPOST(unittest.TestCase):
def assert_interstitial_in_response(_):
mock_authenticate.assert_called_once_with(self.username, self.password)
- interstitial_js_in_template = '<script src="/assets/interstitial.js"></script>'
+ interstitial_js_in_template = '<script src="/public/interstitial.js"></script>'
self.assertIn(interstitial_js_in_template, self.request.written[0])
d.addCallback(assert_interstitial_in_response)