本文整理汇总了Python中logger.accesschecker.AccessChecker._pdf_or_html_access方法的典型用法代码示例。如果您正苦于以下问题:Python AccessChecker._pdf_or_html_access方法的具体用法?Python AccessChecker._pdf_or_html_access怎么用?Python AccessChecker._pdf_or_html_access使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类logger.accesschecker.AccessChecker
的用法示例。
在下文中一共展示了AccessChecker._pdf_or_html_access方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_pdf_or_html_access_for_html
# 需要导入模块: from logger.accesschecker import AccessChecker [as 别名]
# 或者: from logger.accesschecker.AccessChecker import _pdf_or_html_access [as 别名]
def test_pdf_or_html_access_for_html(self):
accesschecker = self.mocker.patch(AccessChecker)
accesschecker._allowed_collections()
self.mocker.result(['scl', 'arg'])
accesschecker._acronym_to_issn_dict()
self.mocker.result({u'zool': u'1984-4670', u'bjmbr': u'1414-431X'})
self.mocker.replay()
ac = AccessChecker(collection='scl')
request = u'GET http://www.scielo.br/scielo.php?pid=S0100-736X2000000300007&script=sci_arttext HTTP/1.1'
self.assertEqual(ac._pdf_or_html_access(request), u'HTML')
request = u'GET /scielo.php?pid=S0100-736X2000000300007&script=sci_arttext HTTP/1.1'
self.assertEqual(ac._pdf_or_html_access(request), u'HTML')
示例2: test_pdf_or_html_access_for_files
# 需要导入模块: from logger.accesschecker import AccessChecker [as 别名]
# 或者: from logger.accesschecker.AccessChecker import _pdf_or_html_access [as 别名]
def test_pdf_or_html_access_for_files(self):
accesschecker = self.mocker.patch(AccessChecker)
accesschecker._allowed_collections()
self.mocker.result([u'scl', u'arg'])
accesschecker._acronym_to_issn_dict()
self.mocker.result({u'zool': u'1984-4670', u'bjmbr': u'1414-431X'})
self.mocker.replay()
ac = AccessChecker(collection='scl')
request = u'GET http://www.scielo.br/css/screen/styles.css HTTP/1.1'
self.assertEqual(ac._pdf_or_html_access(request), None)
request = u'GET /css/screen/styles.css HTTP/1.1'
self.assertEqual(ac._pdf_or_html_access(request), None)
示例3: test_pdf_or_html_access_for_pdf
# 需要导入模块: from logger.accesschecker import AccessChecker [as 别名]
# 或者: from logger.accesschecker.AccessChecker import _pdf_or_html_access [as 别名]
def test_pdf_or_html_access_for_pdf(self):
accesschecker = self.mocker.patch(AccessChecker)
accesschecker._allowed_collections()
self.mocker.result(['scl', 'arg'])
accesschecker._acronym_to_issn_dict()
self.mocker.result({u'zool': u'1984-4670', u'bjmbr': u'1414-431X'})
self.mocker.replay()
ac = AccessChecker(collection='scl')
request = u'GET http://www.scielo.br/pdf/isz/v96n2/a18v96n2.pdf HTTP/1.1'
self.assertEqual(ac._pdf_or_html_access(request), u'PDF')
request = u'GET /pdf/isz/v96n2/a18v96n2.pdf HTTP/1.1'
self.assertEqual(ac._pdf_or_html_access(request), u'PDF')