Esempio n. 1
0
 def setUp(self):
     # unregister the original plugin
     self.stackoverflow_regex, self.stackoverflow_function = registry.plugins['stackoverflow']
     registry.unregister('stackoverflow')
     
     # register a mock, just to verify if the regex is working
     self.called = False
     self.tag = None
     self.limit = 50
     
     def stackoverflow_mock(conn, limit=None, tag=None, **kw):
         self.called = True
         self.tag = tag
         self.limit = int(limit) if limit else 50
     
     registry.register('stackoverflow', self.stackoverflow_regex, stackoverflow_mock)
     
     self.resolver = PluginResolver()
Esempio n. 2
0
 def tearDown(self):
     # undo de mock
     registry.unregister('stackoverflow')
     registry.register('stackoverflow', self.stackoverflow_regex, self.stackoverflow_function)