def _post_teardown(self): twill.remove_wsgi_intercept(self.twill_host, self.twill_port) twill.commands.reset_output() super(TwillTestCase, self)._post_teardown()
def tearDown(self): import twill import twill.commands twill.commands.reset_browser() twill.remove_wsgi_intercept('localhost', 6543) twill.set_output(None) testing.tearDown()
def test_refeed(self): """ Try refeeding the content into the app. """ recorder = scotch.recorder.Recorder(simple_app.iter_app) # first, record. twill.add_wsgi_intercept('localhost', 80, lambda: recorder) try: twill.commands.go('http://localhost:80/') output1 = twill.commands.show() assert simple_app.success() finally: simple_app.reset() twill.remove_wsgi_intercept('localhost', 80) # get the recorded bit. assert len(recorder.record_holder) == 1 record = recorder.record_holder[0] try: response = record.refeed(simple_app.iter_app) assert simple_app.success() output2 = response.get_output() assert output1 == output2 finally: simple_app.reset()
def tearDown(self): # If you get an error on one of these lines, # maybe you didn't run base.TwillTests.setUp? settings.DEBUG_PROPAGATE_EXCEPTIONS = self.old_dbe twill.remove_wsgi_intercept('127.0.0.1', 8080) tc.reset_browser() django.core.cache.cache.get = self.real_get
def teardown(host=None, port=None): """Remove an installed WSGI hook for ``host`` and ```port``. If no host or port is passed, the default values will be assumed. If no hook is installed for the defaults, and both the host and port are missing, the last hook installed will be removed. Returns True if a hook was removed, otherwise False. """ both_missing = not host and not port host = host or DEFAULT_HOST port = port or DEFAULT_PORT key = (host, port) key_to_delete = None if key in INSTALLED: key_to_delete = key if not key in INSTALLED and both_missing and len(INSTALLED) > 0: host, port = key_to_delete = INSTALLED.keys()[-1] if key_to_delete: _, old_propagate = INSTALLED[key_to_delete] del INSTALLED[key_to_delete] result = True if old_propagate is not None: settings.DEBUG_PROPAGATE_EXCEPTIONS = old_propagate else: result = False # note that our return value is just a guess according to our # own records, we pass the request on to twill in any case twill.remove_wsgi_intercept(host, port) return result
def test_multirefeed(self): """ Test playback of multiple requests. """ recorder = scotch.recorder.Recorder(simple_app.post_app) # first, record. twill.add_wsgi_intercept('localhost', 80, lambda: recorder) try: twill.commands.go('http://localhost:80/') assert simple_app.success() simple_app.reset() twill.commands.fv('1', 'test', 'howdy world') twill.commands.submit() twill.commands.find("VALUE WAS: howdy world") assert simple_app.success() finally: simple_app.reset() twill.remove_wsgi_intercept('localhost', 80) # check the length of the recorded bit. assert len(recorder.record_holder) == 2 # play it all back. try: assert not simple_app.success() for record in recorder.record_holder: record.refeed(simple_app.post_app) assert simple_app.success() finally: simple_app.reset()
def test_iter_stuff(): twill.add_wsgi_intercept('localhost', 80, iterator_app) print 'go' twill.commands.go('http://localhost:80/') print 'find' twill.commands.show() twill.commands.find("Hello, world") twill.commands.notfind("Hello, worldHello, world") print 'remove' twill.remove_wsgi_intercept('localhost', 80)
def tearDown(self): # remove intercept twill.remove_wsgi_intercept('localhost', 6543) test_path = os.path.abspath(os.path.dirname(__file__)) fixtures = os.path.join(test_path, 'fixtures') for to_delete in [fname for fname in os.listdir(fixtures) if fname.startswith('Data.fs') or fname in ['blobs', 'mail_queue']]: _rm(os.path.join(fixtures, to_delete))
def test_basic(self): """ Test the basic setup (iter_app, twill, and wsgi_intercept). """ twill.add_wsgi_intercept('localhost', 80, lambda:simple_app.iter_app) try: twill.commands.go('http://localhost:80/') twill.commands.find('WSGI intercept') assert simple_app.success() finally: simple_app.reset() twill.remove_wsgi_intercept('localhost', 80)
def test_intercept(): global _app_was_hit _app_was_hit = False twill.add_wsgi_intercept('localhost', 80, lambda: wsgi_lint(simple_app)) assert not _app_was_hit print 'go' twill.commands.go('http://localhost:80/') twill.commands.show() print 'find' twill.commands.find("WSGI intercept successful") assert _app_was_hit print 'remove' twill.remove_wsgi_intercept('localhost', 80)
def test_passthru(self): """ Make sure that the recorder actually calls the app correctly, etc. """ recorder = scotch.recorder.Recorder(simple_app.iter_app) twill.add_wsgi_intercept('localhost', 80, lambda: recorder) try: twill.commands.go('http://localhost:80/') twill.commands.find('WSGI intercept') assert simple_app.success() finally: simple_app.reset() twill.remove_wsgi_intercept('localhost', 80)
def test_basic(self): """ Test the basic setup (post_app, twill, and wsgi_intercept). """ twill.add_wsgi_intercept('localhost', 80, lambda:simple_app.post_app) try: twill.commands.go('http://localhost:80/') assert simple_app.success() twill.commands.fv('1', 'test', 'howdy world') twill.commands.submit() twill.commands.find("VALUE WAS: howdy world") finally: simple_app.reset() twill.remove_wsgi_intercept('localhost', 80)
def test_passthru(self): """ Make sure that the recorder actually calls the app correctly, etc. """ recorder = scotch.recorder.Recorder(simple_app.post_app) twill.add_wsgi_intercept('localhost', 80, lambda: recorder) try: twill.commands.go('http://localhost:80/') assert simple_app.success() twill.commands.fv('1', 'test', 'howdy world') twill.commands.submit() twill.commands.find("VALUE WAS: howdy world") finally: simple_app.reset() twill.remove_wsgi_intercept('localhost', 80)
def test_multirecord(self): """ Test recording of multiple requests. """ recorder = scotch.recorder.Recorder(simple_app.iter_app) # first, record. twill.add_wsgi_intercept('localhost', 80, lambda: recorder) try: twill.commands.go('http://localhost:80/') assert simple_app.success() simple_app.reset() twill.commands.go('./') assert simple_app.success() finally: simple_app.reset() twill.remove_wsgi_intercept('localhost', 80) # check the length of recorded bit. assert len(recorder.record_holder) == 2
def test_wrapper_intercept(): """ This tests a tricky wsgi_intercept interaction between the 'write' fn passed back from the start_response function in WSGI, and the generator data yielded from the initial app call. See wsgi_intercept.py, section containing 'generator_data', for more info. """ global _app_was_hit _app_was_hit = False wrap_app = wrapper_app(write_app) twill.add_wsgi_intercept('localhost', 80, lambda: wsgi_lint(wrap_app)) assert not _app_was_hit print 'go' twill.commands.go('http://localhost:80/') print 'find' twill.commands.find("WSGI intercept successful") assert _app_was_hit print 'remove' twill.remove_wsgi_intercept('localhost', 80)
def kill_server_wsgi_intercept(): quixote.publish._publisher = None twill.remove_wsgi_intercept(_server_host, _server_port)
def twill_teardown(): twill.remove_wsgi_intercept('127.0.0.1', 8080)
def _post_teardown(self): self._urlconf_teardown() self._fixture_teardown() remove_wsgi_intercept(self.domain, self.port)
def tearDown(self): twill.remove_wsgi_intercept(self.HOST, self.PORT)
def tearDown(self): self.browser.go(reverse_for_twill('admin:logout')) twill.remove_wsgi_intercept(TWILL_TEST_HOST, 80) signals.request_finished.connect(close_connection) settings.DEBUG_PROPAGATE_EXCEPTIONS = self.old_propagate
def __exit__(self, exc_type, exc_value, tb): twill.remove_wsgi_intercept(self.host, self.port) twill.commands.reset_output()
def teardown(self): """ clear test data """ super(TwillMock, self).teardown() User.objects.all().delete() remove_wsgi_intercept(IP, PORT)
def teardown(self): twill.remove_wsgi_intercept('localhost', 80) quixote.cleanup()
def teardown(self): twill.remove_wsgi_intercept("localhost", 80) quixote.cleanup()
def tearDown(self): twill.remove_wsgi_intercept('localhost', 8080) cherrypy.server.stop()
def remove_twill(self): self.restore_twill_output() twill.remove_wsgi_intercept('localhost', 80)
def cleanup(): twill.remove_wsgi_intercept("localhost", 8080) twill.remove_wsgi_intercept("systemexit.de", 80) twill.remove_wsgi_intercept("pypi.python.org", 80) if loadapp: twill.remove_wsgi_intercept("nonroot", 80)
def tearDown(self): super(NaayaFunctionalTestCase, self).tearDown() self.restore_twill_output() twill.remove_wsgi_intercept('localhost', 80)
def twill_teardown(): twill.remove_wsgi_intercept('127.0.0.1', 8080) tc.reset_browser()
def twill_teardown(self): twill.remove_wsgi_intercept('127.0.0.1', TEST_PORT)
def after_all(context): twill.remove_wsgi_intercept("127.0.0.1","8000") twill.commands.reset_output()
def teardown(module): twill.remove_wsgi_intercept('localhost', 4444) cpy.engine.stop()