def test_urlresult_wrong_type_link_context(self):
     msg = ('link_context must be an instance of one of '
            '\(<aenum \'LINK_CONTEXT\'>,\)'
            ' \(provided value: \'LINK_CONTEXT\.no_context\'\)')
     with self.assertRaisesRegex(TypeError, msg):
         URLResult(URLBear, self.affected_code, 'url',
                   'LINK_CONTEXT.no_context')
 def test_urlresult_object_repr(self):
     repr_result = repr(
         URLResult(URLBear, self.affected_code, 'http://google.com',
                   LINK_CONTEXT.no_context))
     repr_regex = ('<URLResult object\(id=.+, origin=\'bearclass\', '
                   'affected_code=\(<SourceRange object\(start=<SourcePosit'
                   'ion object\(file=\'.+\', line=1, column=None\) at .+>, '
                   'end=<SourcePosition object\(file=\'.+\', line=1, column'
                   '=None\) at .+>\) at .+>,\), message=\'Found '
                   'http://google.com with context: LINK_CONTEXT.no_contex'
                   't\', link=\'http://google.com\', link_context=<LINK_CON'
                   'TEXT.no_context: 0>\) at .+>')
     self.assertRegex(repr_result, repr_regex)
 def test_urlresult_wrong_type_link(self):
     msg = ('link must be an instance of one of '
            '\(<class \'str\'>,\) \(provided value: 17072017\)')
     with self.assertRaisesRegex(TypeError, msg):
         URLResult(URLBear, self.affected_code, 17072017,
                   LINK_CONTEXT.no_context)
Beispiel #4
0
 def test_urlresult_wrong_type_http_status_code(self):
     msg = ('http_status_code must be an instance of one of '
            '\(<class \'int\'>, None\) \(provided value: \'1\'\)')
     with self.assertRaisesRegex(TypeError, msg):
         URLResult(URLBear, self.affected_code, 'url', '1',
                   LINK_CONTEXT.no_context)