Python AngularAppPortalRootTraverser Example

说明

python angularappportalroottraverser示例是从最受好评的开源项目中提取的实现代码,你可以参考下面示例的使用方式。

编程语言: Python

命名空间/包名称: ploneappangularjstraversal

示例#1
文件: test_traversal.py项目: jean/plone.app.angularjs

 def test_api_overview(self):
     self.request.URL = 'http://nohost/plone/++api++v1/'
     directlyProvides(self.request, IAPIRequest)
     traversal = AngularAppPortalRootTraverser(self.portal, self.request)
     view = traversal.publishTraverse(
         self.request,
         ""
     )
     self.assertTrue(
         "<h1>REST API</h1>" in view()
     )

示例#2
文件: test_traversal.py项目: jean/plone.app.angularjs

 def test_api_non_existing_method(self):
     self.request.URL = 'http://nohost/plone/++api++v1/'
     directlyProvides(self.request, IAPIRequest)
     traversal = AngularAppPortalRootTraverser(self.portal, self.request)
     view = traversal.publishTraverse(
         self.request,
         "non_existing_api_method"
     )
     self.assertEqual(
         json.loads(view)['message'],
         "API method 'non_existing_api_method' not found."
     )

示例#3
文件: test_traversal.py项目: jean/plone.app.angularjs

 def test_front_page_returns_angular_app(self):
     self.request.URL = 'http://nohost/plone/front-page'
     traversal = AngularAppPortalRootTraverser(self.portal, self.request)
     view = traversal.publishTraverse(self.request, "front-page")
     self.assertTrue('ng-app' in view)

示例#4
文件: test_traversal.py项目: jean/plone.app.angularjs

 def test_api_top_navigation(self):
     self.request.URL = 'http://nohost/plone/++api++v1/'
     directlyProvides(self.request, IAPIRequest)
     traversal = AngularAppPortalRootTraverser(self.portal, self.request)
     view = traversal.publishTraverse(self.request, "top_navigation")
     self.assertEqual(json.loads(view()), [])

示例#5
文件: test_traversal.py项目: jean/plone.app.angularjs

 def test_portal_root_folder_listing_returns_angular_app(self):
     self.request.URL = 'http://nohost/plone/folder_listing'
     traversal = AngularAppPortalRootTraverser(self.portal, self.request)
     view = traversal.publishTraverse(self.request, "folder_listing")
     self.assertTrue('ng-app' in view)

展开阅读全文