Removed the URLer service

We don't have a need for it any more, so it can go.
This commit is contained in:
2018-01-31 14:33:41 +01:00
parent 08a814525b
commit 1b57b333df
6 changed files with 17 additions and 45 deletions

View File

@@ -9,6 +9,10 @@ from pillar.tests import AbstractPillarTest
class JSTreeTest(AbstractPillarTest):
def setUp(self, **kwargs):
super().setUp(**kwargs)
self.project_id, self.project = self.ensure_project_exists()
def test_jstree_parse_node(self):
from pillar.web.utils.jstree import jstree_parse_node
@@ -19,7 +23,7 @@ class JSTreeTest(AbstractPillarTest):
'picture': ObjectId('55f338f92beb3300c4ff99de'),
'description': 'Play the full movie and see how it was cobbled together.',
'parent': ObjectId('55f338f92beb3300c4ff99f9'),
'project': ObjectId('55f338f92beb3300c4ff99e5'),
'project': self.project_id,
'node_type': 'asset',
'user': ObjectId('552b066b41acdf5dec4436f2'),
'properties': {'status': 'published',
@@ -27,14 +31,12 @@ class JSTreeTest(AbstractPillarTest):
'content_type': 'file'},
'name': 'Live <strong>Edit</strong>'}
# Mocking url_for_node prevents us from setting up a project and an URLer service.
with mock.patch('pillar.web.nodes.routes.url_for_node') as mock_url_for_node:
mock_url_for_node.return_value = '/the/url'
with self.app.test_request_context():
parsed = jstree_parse_node(Node(node_doc))
self.assertEqual(parsed, {
'id': 'n_55f338f92beb3300c4ff99fe',
'a_attr': {'href': '/the/url'},
'a_attr': {'href': f"/p/{self.project['url']}/55f338f92beb3300c4ff99fe"},
'li_attr': {'data-node-type': 'asset'},
'text': Markup('Live &lt;strong&gt;Edit&lt;/strong&gt;'),
'type': 'file',
@@ -52,7 +54,7 @@ class JSTreeTest(AbstractPillarTest):
'picture': ObjectId('55f338f92beb3300c4ff99de'),
'description': 'Play the full movie and see how it was cobbled together.',
'parent': ObjectId('55f338f92beb3300c4ff99f9'),
'project': ObjectId('55f338f92beb3300c4ff99e5'),
'project': self.project_id,
'node_type': 'blog',
'user': ObjectId('552b066b41acdf5dec4436f2'),
'properties': {'status': 'published',
@@ -60,14 +62,12 @@ class JSTreeTest(AbstractPillarTest):
'content_type': 'file'},
'name': 'Live <strong>Edit</strong>'}
# Mocking url_for_node prevents us from setting up a project and an URLer service.
with mock.patch('pillar.web.nodes.routes.url_for_node') as mock_url_for_node:
mock_url_for_node.return_value = '/the/url'
with self.app.test_request_context():
parsed = jstree_parse_node(Node(node_doc))
self.assertEqual(parsed, {
'id': 'n_55f338f92beb3300c4ff99fe',
'a_attr': {'href': '/the/url'},
'a_attr': {'href': '/blog/'},
'li_attr': {'data-node-type': 'blog'},
'text': Markup('Live &lt;strong&gt;Edit&lt;/strong&gt;'),
'type': 'blog',
@@ -82,19 +82,17 @@ class JSTreeTest(AbstractPillarTest):
'_created': parse('2015-09-11T22:26:33.000+0200'),
'_updated': parse('2015-10-30T22:44:27.000+0100'),
'_etag': '5248485b4ea7e55e858ff84b1bd4aae88917a37c',
'project': ObjectId('55f338f92beb3300c4ff99e5'),
'project': self.project_id,
'node_type': 'asset',
'user': ObjectId('552b066b41acdf5dec4436f2'),
'name': 'Live <strong>Edit</strong>'}
# Mocking url_for_node prevents us from setting up a project and an URLer service.
with mock.patch('pillar.web.nodes.routes.url_for_node') as mock_url_for_node:
mock_url_for_node.return_value = '/the/url'
with self.app.test_request_context():
parsed = jstree_parse_node(Node(node_doc))
self.assertEqual(parsed, {
'id': 'n_55f338f92beb3300c4ff99fe',
'a_attr': {'href': '/the/url'},
'a_attr': {'href': f"/p/{self.project['url']}/55f338f92beb3300c4ff99fe"},
'li_attr': {'data-node-type': 'asset'},
'text': Markup('Live &lt;strong&gt;Edit&lt;/strong&gt;'),
'type': 'asset',