コード例 #1
0
ファイル: flask_testing.py プロジェクト: fabioperrella/fedora
    def _post_teardown(self):

        twill.remove_wsgi_intercept(self.twill_host, self.twill_port)

        twill.commands.reset_output()

        super(TwillTestCase, self)._post_teardown()
コード例 #2
0
ファイル: test_integration.py プロジェクト: markramm/pyramid
 def tearDown(self):
     import twill
     import twill.commands
     twill.commands.reset_browser()
     twill.remove_wsgi_intercept('localhost', 6543)
     twill.set_output(None)
     testing.tearDown()
コード例 #3
0
ファイル: test-recorder.py プロジェクト: pepe5/scotch
    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()
コード例 #4
0
 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
コード例 #5
0
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
コード例 #6
0
ファイル: test-recorder.py プロジェクト: pepe5/scotch
    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()
コード例 #7
0
ファイル: twill_runner.py プロジェクト: SongJLG/johan-doc
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
コード例 #8
0
ファイル: testing.py プロジェクト: gperetin/flask-testing
    def _post_teardown(self):

        twill.remove_wsgi_intercept(self.twill_host, 
                                    self.twill_port)

        twill.commands.reset_output()
        
        super(TwillTestCase, self)._post_teardown()
コード例 #9
0
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)
コード例 #10
0
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)
コード例 #11
0
ファイル: test_twill_wsgi.py プロジェクト: boothead/karl
    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))
コード例 #12
0
ファイル: test-recorder.py プロジェクト: pepe5/scotch
 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)
コード例 #13
0
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)
コード例 #14
0
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)
コード例 #15
0
ファイル: test-recorder.py プロジェクト: pepe5/scotch
    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)
コード例 #16
0
ファイル: test-recorder.py プロジェクト: pepe5/scotch
 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)
コード例 #17
0
ファイル: test-recorder.py プロジェクト: pepe5/scotch
    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)
コード例 #18
0
ファイル: test-recorder.py プロジェクト: pepe5/scotch
    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
コード例 #19
0
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)
コード例 #20
0
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)
コード例 #21
0
ファイル: testutil.py プロジェクト: sjl421/pony-build
def kill_server_wsgi_intercept():
    quixote.publish._publisher = None
    twill.remove_wsgi_intercept(_server_host, _server_port)
コード例 #22
0
ファイル: tests.py プロジェクト: athonlab/OpenHatch
def twill_teardown():
    twill.remove_wsgi_intercept('127.0.0.1', 8080)
コード例 #23
0
ファイル: testutil.py プロジェクト: ctb/pony-build
def kill_server_wsgi_intercept():
    quixote.publish._publisher = None
    twill.remove_wsgi_intercept(_server_host, _server_port)
コード例 #24
0
ファイル: testcases.py プロジェクト: bhuztez/django-twilltest
 def _post_teardown(self):
 
     self._urlconf_teardown()
     self._fixture_teardown()
     remove_wsgi_intercept(self.domain, self.port)
コード例 #25
0
ファイル: helpers.py プロジェクト: RuuPiE/django-oscar
 def tearDown(self):
     twill.remove_wsgi_intercept(self.HOST, self.PORT)
コード例 #26
0
 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
コード例 #27
0
ファイル: flask_testing.py プロジェクト: fabioperrella/fedora
    def __exit__(self, exc_type, exc_value, tb):
        twill.remove_wsgi_intercept(self.host, self.port)

        twill.commands.reset_output()
コード例 #28
0
 def teardown(self):
     """ clear test data """
     super(TwillMock, self).teardown()
     User.objects.all().delete()
     remove_wsgi_intercept(IP, PORT)
コード例 #29
0
ファイル: test-wsgi.py プロジェクト: zhou0/quixote
    def teardown(self):
        twill.remove_wsgi_intercept('localhost', 80)

        quixote.cleanup()
コード例 #30
0
ファイル: test-wsgi.py プロジェクト: nascheme/quixote
    def teardown(self):
        twill.remove_wsgi_intercept("localhost", 80)

        quixote.cleanup()
コード例 #31
0
 def tearDown(self):
     twill.remove_wsgi_intercept('localhost', 8080)
     cherrypy.server.stop()
コード例 #32
0
 def remove_twill(self):
     self.restore_twill_output()
     twill.remove_wsgi_intercept('localhost', 80)
コード例 #33
0
ファイル: test_app.py プロジェクト: SAEPython/pypiserver4sae
 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)
コード例 #34
0
 def tearDown(self):
     super(NaayaFunctionalTestCase, self).tearDown()
     self.restore_twill_output()
     twill.remove_wsgi_intercept('localhost', 80)
コード例 #35
0
ファイル: testing.py プロジェクト: gperetin/flask-testing
    def __exit__(self, exc_type, exc_value, tb):
        twill.remove_wsgi_intercept(self.host, 
                                    self.port)

        twill.commands.reset_output()
コード例 #36
0
def twill_teardown():
    twill.remove_wsgi_intercept('127.0.0.1', 8080)
    tc.reset_browser()
コード例 #37
0
 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)
コード例 #38
0
ファイル: tests.py プロジェクト: mmernik/net-almanac
 def twill_teardown(self):
     twill.remove_wsgi_intercept('127.0.0.1', TEST_PORT)
コード例 #39
0
ファイル: environment.py プロジェクト: DotNetAge/lab-ci
def after_all(context):
    twill.remove_wsgi_intercept("127.0.0.1","8000")
    twill.commands.reset_output()
コード例 #40
0
ファイル: tests.py プロジェクト: pandark/oh-mainline
def twill_teardown():
    twill.remove_wsgi_intercept('127.0.0.1', 8080)
    tc.reset_browser()
コード例 #41
0
 def remove_twill(self):
     self.restore_twill_output()
     twill.remove_wsgi_intercept('localhost', 80)
コード例 #42
0
ファイル: helpers.py プロジェクト: AndrewIngram/django-oscar
 def tearDown(self):
     twill.remove_wsgi_intercept(self.HOST, self.PORT)
コード例 #43
0
def twill_teardown():
    twill.remove_wsgi_intercept('127.0.0.1', 8080)
コード例 #44
0
def teardown(module):
    twill.remove_wsgi_intercept('localhost', 4444)
    cpy.engine.stop()