Commit c107fb71 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_hal_json_style] Do not harcode domain/port

parent e4bfb062
......@@ -250,22 +250,22 @@ class TestERP5Document_getHateoas_mode_root(ERP5HALJSONStyleSkinsMixin):
{"href": "urn:jio:get:%s" % parent.getRelativeUrl(), "name": parent.getTitle()})
self.assertEqual(result_dict['_links']['view'][0]['href'],
"http://nohost/%s/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view" % (
self.portal.getId(),
"%s/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view" % (
self.portal.absolute_url(),
urllib.quote_plus(document.getRelativeUrl())))
self.assertEqual(result_dict['_links']['view'][0]['title'], "View")
self.assertEqual(result_dict['_links']['view'][0]['name'], "view")
self.assertEqual(result_dict['_links']['action_object_view'][0]['href'],
"http://nohost/%s/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view" % (
self.portal.getId(),
"%s/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view" % (
self.portal.absolute_url(),
urllib.quote_plus(document.getRelativeUrl())))
self.assertEqual(result_dict['_links']['action_object_view'][0]['title'], "View")
self.assertEqual(result_dict['_links']['action_object_view'][0]['name'], "view")
self.assertEqual(result_dict['_links']['action_workflow'][0]['href'],
"http://nohost/%s/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=custom_action_no_dialog" % (
self.portal.getId(),
"%s/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=custom_action_no_dialog" % (
self.portal.absolute_url(),
urllib.quote_plus(document.getRelativeUrl())))
self.assertEqual(result_dict['_links']['action_workflow'][0]['title'], "Custom Action No Dialog")
self.assertEqual(result_dict['_links']['action_workflow'][0]['name'], "custom_action_no_dialog")
......@@ -278,8 +278,8 @@ class TestERP5Document_getHateoas_mode_root(ERP5HALJSONStyleSkinsMixin):
self.assertEqual(result_dict['_links']['site_root']['name'], document.getPortalObject().getTitle())
self.assertEqual(result_dict['_links']['action_object_new_content_action']['href'],
"http://nohost/%s/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=create_a_document" % (
self.portal.getId(),
"%s/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=create_a_document" % (
self.portal.absolute_url(),
urllib.quote_plus(document.getRelativeUrl())))
self.assertEqual(result_dict['_links']['action_object_new_content_action']['title'], "Create a Document")
self.assertEqual(result_dict['_links']['action_object_new_content_action']['name'], "create_a_document")
......@@ -311,22 +311,22 @@ class TestERP5Document_getHateoas_mode_root(ERP5HALJSONStyleSkinsMixin):
{"href": "urn:jio:get:%s" % parent.getRelativeUrl(), "name": parent.getTitle()})
self.assertEqual(result_dict['_links']['view'][0]['href'],
"http://nohost/%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view" % (
self.portal.getId(),
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view" % (
self.portal.absolute_url(),
urllib.quote_plus(document.getRelativeUrl())))
self.assertEqual(result_dict['_links']['view'][0]['title'], "View")
self.assertEqual(result_dict['_links']['view'][0]['name'], "view")
self.assertEqual(result_dict['_links']['action_object_view'][0]['href'],
"http://nohost/%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view" % (
self.portal.getId(),
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view" % (
self.portal.absolute_url(),
urllib.quote_plus(document.getRelativeUrl())))
self.assertEqual(result_dict['_links']['action_object_view'][0]['title'], "View")
self.assertEqual(result_dict['_links']['action_object_view'][0]['name'], "view")
self.assertEqual(result_dict['_links']['action_workflow'][0]['href'],
"http://nohost/%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=embed_action" % (
self.portal.getId(),
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=embed_action" % (
self.portal.absolute_url(),
urllib.quote_plus(document.getRelativeUrl())))
self.assertEqual(result_dict['_links']['action_workflow'][0]['title'], "Embed")
self.assertEqual(result_dict['_links']['action_workflow'][0]['name'], "embed_action")
......@@ -338,8 +338,8 @@ class TestERP5Document_getHateoas_mode_root(ERP5HALJSONStyleSkinsMixin):
self.assertEqual(result_dict['_links']['site_root']['name'], document.getTitle())
self.assertEqual(result_dict['_links']['action_object_new_content_action']['href'],
"http://nohost/%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=create_a_document" % (
self.portal.getId(),
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=create_a_document" % (
self.portal.absolute_url(),
urllib.quote_plus(document.getRelativeUrl())))
self.assertEqual(result_dict['_links']['action_object_new_content_action']['title'], "Create a Document")
self.assertEqual(result_dict['_links']['action_object_new_content_action']['name'], "create_a_document")
......@@ -348,12 +348,12 @@ class TestERP5Document_getHateoas_mode_root(ERP5HALJSONStyleSkinsMixin):
self.assertEqual(result_dict['_links']['type']['name'], document.getPortalType())
self.assertEqual(result_dict['_links']['raw_search']['href'],
"http://nohost/%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=search{&query,select_list*,limit*}" % self.portal.getId())
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=search{&query,select_list*,limit*}" % self.portal.absolute_url())
self.assertEqual(result_dict['_links']['raw_search']['templated'], True)
self.assertEqual(result_dict['_links']['raw_search']['name'], "Raw Search")
self.assertEqual(result_dict['_links']['traverse']['href'],
"http://nohost/%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse{&relative_url,view}" % self.portal.getId())
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse{&relative_url,view}" % self.portal.absolute_url())
self.assertEqual(result_dict['_links']['traverse']['templated'], True)
self.assertEqual(result_dict['_links']['traverse']['name'], "Traverse")
......@@ -397,22 +397,22 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
{"href": "urn:jio:get:%s" % parent.getRelativeUrl(), "name": parent.getTitle()})
self.assertEqual(result_dict['_links']['view'][0]['href'],
"http://nohost/%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view" % (
self.portal.getId(),
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view" % (
self.portal.absolute_url(),
urllib.quote_plus(document.getRelativeUrl())))
self.assertEqual(result_dict['_links']['view'][0]['title'], "View")
self.assertEqual(result_dict['_links']['view'][0]['name'], "view")
self.assertEqual(result_dict['_links']['action_object_view'][0]['href'],
"http://nohost/%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view" % (
self.portal.getId(),
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view" % (
self.portal.absolute_url(),
urllib.quote_plus(document.getRelativeUrl())))
self.assertEqual(result_dict['_links']['action_object_view'][0]['title'], "View")
self.assertEqual(result_dict['_links']['action_object_view'][0]['name'], "view")
self.assertEqual(result_dict['_links']['action_workflow'][0]['href'],
"http://nohost/%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=custom_action_no_dialog" % (
self.portal.getId(),
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=custom_action_no_dialog" % (
self.portal.absolute_url(),
urllib.quote_plus(document.getRelativeUrl())))
self.assertEqual(result_dict['_links']['action_workflow'][0]['title'], "Custom Action No Dialog")
self.assertEqual(result_dict['_links']['action_workflow'][0]['name'], "custom_action_no_dialog")
......@@ -424,8 +424,8 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
self.assertEqual(result_dict['_links']['site_root']['name'], self.portal.web_site_module.hateoas.getTitle())
self.assertEqual(result_dict['_links']['action_object_new_content_action']['href'],
"http://nohost/%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=create_a_document" % (
self.portal.getId(),
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=create_a_document" % (
self.portal.absolute_url(),
urllib.quote_plus(document.getRelativeUrl())))
self.assertEqual(result_dict['_links']['action_object_new_content_action']['title'], "Create a Document")
self.assertEqual(result_dict['_links']['action_object_new_content_action']['name'], "create_a_document")
......@@ -457,22 +457,22 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
{"href": "urn:jio:get:%s" % parent.getRelativeUrl(), "name": parent.getTitle()})
self.assertEqual(result_dict['_links']['view'][0]['href'],
"http://nohost/%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view" % (
self.portal.getId(),
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view" % (
self.portal.absolute_url(),
urllib.quote_plus(document.getRelativeUrl())))
self.assertEqual(result_dict['_links']['view'][0]['title'], "View")
self.assertEqual(result_dict['_links']['view'][0]['name'], "view")
self.assertEqual(result_dict['_links']['action_object_view'][0]['href'],
"http://nohost/%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view" % (
self.portal.getId(),
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view" % (
self.portal.absolute_url(),
urllib.quote_plus(document.getRelativeUrl())))
self.assertEqual(result_dict['_links']['action_object_view'][0]['title'], "View")
self.assertEqual(result_dict['_links']['action_object_view'][0]['name'], "view")
self.assertEqual(result_dict['_links']['action_workflow'][0]['href'],
"http://nohost/%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=custom_action_no_dialog" % (
self.portal.getId(),
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=custom_action_no_dialog" % (
self.portal.absolute_url(),
urllib.quote_plus(document.getRelativeUrl())))
self.assertEqual(result_dict['_links']['action_workflow'][0]['title'], "Custom Action No Dialog")
self.assertEqual(result_dict['_links']['action_workflow'][0]['name'], "custom_action_no_dialog")
......@@ -484,8 +484,8 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
self.assertEqual(result_dict['_links']['site_root']['name'], self.portal.web_site_module.hateoas.getTitle())
self.assertEqual(result_dict['_links']['action_object_new_content_action']['href'],
"http://nohost/%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=create_a_document" % (
self.portal.getId(),
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=create_a_document" % (
self.portal.absolute_url(),
urllib.quote_plus(document.getRelativeUrl())))
self.assertEqual(result_dict['_links']['action_object_new_content_action']['title'], "Create a Document")
self.assertEqual(result_dict['_links']['action_object_new_content_action']['name'], "create_a_document")
......@@ -516,15 +516,15 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
self.assertEqual(result_dict['_embedded']['_view']['_links']['traversed_document']['name'], document.getRelativeUrl())
self.assertEqual(result_dict['_embedded']['_view']['_links']['traversed_document']['title'], document.getTitle().decode("UTF-8"))
self.assertEqual(result_dict['_embedded']['_view']['_links']['self']['href'], "http://nohost/%s/%s/Foo_view" % (
self.portal.getId(),
self.assertEqual(result_dict['_embedded']['_view']['_links']['self']['href'], "%s/%s/Foo_view" % (
self.portal.absolute_url(),
document.getRelativeUrl()))
self.assertEqual(result_dict['_embedded']['_view']['_links']['form_definition']['href'], 'urn:jio:get:portal_skins/erp5_ui_test/Foo_view')
self.assertEqual(result_dict['_embedded']['_view']['_links']['form_definition']['name'], 'Foo_view')
self.assertEqual(result_dict['_embedded']['_view']['_actions']['put']['href'], 'http://nohost/%s/web_site_module/hateoas/%s/Base_edit' % (
self.portal.getId(),
self.assertEqual(result_dict['_embedded']['_view']['_actions']['put']['href'], '%s/web_site_module/hateoas/%s/Base_edit' % (
self.portal.absolute_url(),
document.getRelativeUrl()))
self.assertEqual(result_dict['_embedded']['_view']['_actions']['put']['method'], 'POST')
......@@ -548,15 +548,15 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
{"href": "urn:jio:get:", "name": self.portal.getTitle()})
self.assertEqual(result_dict['_links']['view'][0]['href'],
"http://nohost/%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=consistency" % (
self.portal.getId(),
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=consistency" % (
self.portal.absolute_url(),
urllib.quote_plus("portal_skins/erp5_ui_test/Foo_view")))
self.assertEqual(result_dict['_links']['view'][0]['title'], "Consistency")
self.assertEqual(result_dict['_links']['view'][0]['name'], "consistency")
self.assertEqual(result_dict['_links']['action_object_view'][0]['href'],
"http://nohost/%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=consistency" % (
self.portal.getId(),
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=consistency" % (
self.portal.absolute_url(),
urllib.quote_plus("portal_skins/erp5_ui_test/Foo_view")))
self.assertEqual(result_dict['_links']['action_object_view'][0]['title'], "Consistency")
self.assertEqual(result_dict['_links']['action_object_view'][0]['name'], "consistency")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment