當前位置: 首頁>>代碼示例>>Python>>正文


Python views.AtramhasisView類代碼示例

本文整理匯總了Python中atramhasis.views.views.AtramhasisView的典型用法代碼示例。如果您正苦於以下問題:Python AtramhasisView類的具體用法?Python AtramhasisView怎麽用?Python AtramhasisView使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了AtramhasisView類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_passing_view

 def test_passing_view(self):
     request = testing.DummyRequest()
     request.skos_registry = self.regis
     atramhasisview = AtramhasisView(request)
     info = atramhasisview.home_view()
     self.assertIsNotNone(info['conceptschemes'][0])
     self.assertEqual(info['conceptschemes'][0]['id'], 'TREES')
開發者ID:JDeVos,項目名稱:atramhasis,代碼行數:7,代碼來源:test_views.py

示例2: test_passing_view

 def test_passing_view(self):
     self.request.skos_registry = self.regis
     atramhasisview = AtramhasisView(self.request)
     response = atramhasisview.favicon_view()
     self.assertEqual(response.status_int, 200)
     self.assertIn('image/x-icon', response.headers['Content-Type'])
     self.assertIsNotNone(response.body)
開發者ID:anukat2015,項目名稱:atramhasis,代碼行數:7,代碼來源:test_views.py

示例3: test_default_locale

 def test_default_locale(self):
     config_default_lang = settings.get('pyramid.default_locale_name')
     self.request.referer = None
     self.request.skos_registry = self.regis
     atramhasisview = AtramhasisView(self.request)
     res = atramhasisview.set_locale_cookie()
     self.assertTrue((res.headers.get('Set-Cookie')).startswith('_LOCALE_=' + config_default_lang))
開發者ID:anukat2015,項目名稱:atramhasis,代碼行數:7,代碼來源:test_views.py

示例4: test_no_schema

 def test_no_schema(self):
     self.request.matchdict['scheme_id'] = 'GG'
     self.request.params = MultiDict()
     self.request.skos_registry = self.regis
     atramhasisview = AtramhasisView(self.request)
     info = atramhasisview.search_result()
     self.assertEqual(info.status_int, 404)
開發者ID:anukat2015,項目名稱:atramhasis,代碼行數:7,代碼來源:test_views.py

示例5: test_no_type

 def test_no_type(self):
     request = self.request
     request.matchdict['scheme_id'] = 'TREES'
     request.matchdict['c_id'] = '555'
     request.skos_registry = self.regis
     atramhasisview = AtramhasisView(request)
     info = atramhasisview.concept_view()
     self.assertEqual(info.status_int, 500)
開發者ID:JDeVos,項目名稱:atramhasis,代碼行數:8,代碼來源:test_views.py

示例6: test_conceptschemes_view

 def test_conceptschemes_view(self):
     atramhasisview = AtramhasisView(self.request)
     res = atramhasisview.conceptschemes_view()
     self.assertIn('conceptschemes', res)
     self.assertEqual(len(res['conceptschemes']), 1)
     cs = res['conceptschemes'][0]
     self.assertIn('id', cs)
     self.assertIn('conceptscheme', cs)
開發者ID:anukat2015,項目名稱:atramhasis,代碼行數:8,代碼來源:test_views.py

示例7: test_locale_uppercase

 def test_locale_uppercase(self):
     testlang = 'it'
     self.request.GET['language'] = testlang.upper()
     self.request.referer = None
     self.request.skos_registry = self.regis
     atramhasisview = AtramhasisView(self.request)
     res = atramhasisview.set_locale_cookie()
     self.assertTrue((res.headers.get('Set-Cookie')).startswith('_LOCALE_=' + testlang))
開發者ID:anukat2015,項目名稱:atramhasis,代碼行數:8,代碼來源:test_views.py

示例8: test_no_querystring

 def test_no_querystring(self):
     self.request.matchdict['scheme_id'] = 'TREES'
     self.request.params = MultiDict()
     self.request.skos_registry = self.regis
     atramhasisview = AtramhasisView(self.request)
     info = atramhasisview.search_result()
     self.assertIsNotNone(info['concepts'])
     self.assertEqual(len(info['concepts']), 3)
開發者ID:anukat2015,項目名稱:atramhasis,代碼行數:8,代碼來源:test_views.py

示例9: test_unsupported_lang

 def test_unsupported_lang(self):
     config_default_lang = settings.get('pyramid.default_locale_name')
     request = testing.DummyRequest()
     request.GET['language'] = 'XX'
     request.referer = None
     request.skos_registry = self.regis
     atramhasisview = AtramhasisView(request)
     res = atramhasisview.set_locale_cookie()
     self.assertTrue((res.headers.get('Set-Cookie')).startswith('_LOCALE_=' + config_default_lang))
開發者ID:JDeVos,項目名稱:atramhasis,代碼行數:9,代碼來源:test_views.py

示例10: test_csv

 def test_csv(self):
     self.request.matchdict['scheme_id'] = 'TREES'
     self.request.params = MultiDict()
     atramhasisview = AtramhasisView(self.request)
     res = atramhasisview.results_csv()
     self.assertEqual(res['filename'], 'atramhasis_export')
     self.assertIsInstance(res['header'], list)
     self.assertIsInstance(res['rows'], list)
     self.assertEqual(2, len(res['rows']))
開發者ID:JDeVos,項目名稱:atramhasis,代碼行數:9,代碼來源:test_views.py

示例11: test_passing_collection_view

 def test_passing_collection_view(self):
     request = self.request
     request.matchdict['scheme_id'] = 'TREES'
     request.matchdict['c_id'] = '3'
     request.skos_registry = self.regis
     atramhasisview = AtramhasisView(request)
     info = atramhasisview.concept_view()
     self.assertIsNotNone(info['concept'])
     self.assertEqual(info['conceptType'], 'Collection')
     self.assertEqual(info['scheme_id'], 'TREES')
開發者ID:JDeVos,項目名稱:atramhasis,代碼行數:10,代碼來源:test_views.py

示例12: test_referer

 def test_referer(self):
     testlang = 'it'
     testurl = 'http://www.foo.bar'
     self.request.GET['language'] = testlang.upper()
     self.request.referer = testurl
     self.request.skos_registry = self.regis
     atramhasisview = AtramhasisView(self.request)
     res = atramhasisview.set_locale_cookie()
     self.assertEqual(res.status, '302 Found')
     self.assertEqual(res.location, testurl)
開發者ID:anukat2015,項目名稱:atramhasis,代碼行數:10,代碼來源:test_views.py

示例13: test_conceptscheme_view

 def test_conceptscheme_view(self):
     self.request.matchdict['scheme_id'] = 'TREES'
     atramhasisview = AtramhasisView(self.request)
     res = atramhasisview.conceptscheme_view()
     self.assertIsNotNone(res)
     self.assertIsNotNone(res['conceptscheme'])
     self.assertEqual(res['conceptscheme']['title'], 'TREES')
     self.assertEqual(res['conceptscheme']['scheme_id'], 'TREES')
     self.assertEqual(res['conceptscheme']['uri'], 'urn:x-skosprovider:trees')
     self.assertIsNotNone(res['conceptscheme']['labels'])
     self.assertIsNotNone(res['conceptscheme']['notes'])
     self.assertIsNotNone(res['conceptscheme']['top_concepts'])
開發者ID:JDeVos,項目名稱:atramhasis,代碼行數:12,代碼來源:test_views.py

示例14: test_find_by_concept

 def test_find_by_concept(self):
     self.request.matchdict['scheme_id'] = 'TREES'
     self.request.params = MultiDict()
     self.request.params.add('ctype', 'concept')
     self.request.params.add('_LOCALE_', 'nl')
     self.request.skos_registry = self.regis
     atramhasisview = AtramhasisView(self.request)
     info = atramhasisview.search_result()
     self.assertIsNotNone(info['concepts'])
     concept = info['concepts'][0]
     self.assertIsNotNone(concept)
     self.assertEqual(info['scheme_id'], 'TREES')
開發者ID:anukat2015,項目名稱:atramhasis,代碼行數:12,代碼來源:test_views.py

示例15: test_not_found

 def test_not_found(self):
     request = self.request
     request.matchdict['scheme_id'] = 'TREES'
     request.matchdict['c_id'] = '666'
     request.skos_registry = self.regis
     error_raised = False
     try:
         atramhasisview = AtramhasisView(request)
         atramhasisview.concept_view()
     except ConceptNotFoundException as e:
         error_raised = True
         self.assertIsNotNone(e.__str__())
     self.assertTrue(error_raised)
開發者ID:JDeVos,項目名稱:atramhasis,代碼行數:13,代碼來源:test_views.py


注:本文中的atramhasis.views.views.AtramhasisView類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。