当前位置: 首页>>代码示例>>Python>>正文


Python twill.remove_wsgi_intercept函数代码示例

本文整理汇总了Python中twill.remove_wsgi_intercept函数的典型用法代码示例。如果您正苦于以下问题:Python remove_wsgi_intercept函数的具体用法?Python remove_wsgi_intercept怎么用?Python remove_wsgi_intercept使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了remove_wsgi_intercept函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: tearDown

 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
开发者ID:nibaren2012,项目名称:oh-mainline,代码行数:7,代码来源:tests.py

示例2: teardown

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
开发者ID:SongJLG,项目名称:johan-doc,代码行数:34,代码来源:twill_runner.py

示例3: test_multirefeed

    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()
开发者ID:ctb,项目名称:scotch,代码行数:32,代码来源:test-recorder.py

示例4: test_refeed

    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()
开发者ID:ctb,项目名称:scotch,代码行数:28,代码来源:test-recorder.py

示例5: 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()
开发者ID:markramm,项目名称:pyramid,代码行数:7,代码来源:test_integration.py

示例6: _post_teardown

    def _post_teardown(self):

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

        twill.commands.reset_output()
        
        super(TwillTestCase, self)._post_teardown()
开发者ID:gperetin,项目名称:flask-testing,代码行数:8,代码来源:testing.py

示例7: test_iter_stuff

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)
开发者ID:ArtMatt,项目名称:twill-ca,代码行数:10,代码来源:test-wsgi-intercept.py

示例8: tearDown

    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))
开发者ID:boothead,项目名称:karl,代码行数:10,代码来源:test_twill_wsgi.py

示例9: test_basic

 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)
开发者ID:ctb,项目名称:scotch,代码行数:13,代码来源:test-recorder.py

示例10: test_intercept

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)
开发者ID:ArtMatt,项目名称:twill-ca,代码行数:14,代码来源:test-wsgi-intercept.py

示例11: test_passthru

    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)
开发者ID:ctb,项目名称:scotch,代码行数:15,代码来源:test-recorder.py

示例12: test_multirecord

    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
开发者ID:ctb,项目名称:scotch,代码行数:21,代码来源:test-recorder.py

示例13: test_wrapper_intercept

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)
开发者ID:ArtMatt,项目名称:twill-ca,代码行数:23,代码来源:test-wsgi-intercept.py

示例14: remove_twill

 def remove_twill(self):
     self.restore_twill_output()
     twill.remove_wsgi_intercept('localhost', 80)
开发者ID:bogtan,项目名称:Naaya,代码行数:3,代码来源:NaayaFunctionalTestCase.py

示例15: kill_server_wsgi_intercept

def kill_server_wsgi_intercept():
    quixote.publish._publisher = None
    twill.remove_wsgi_intercept(_server_host, _server_port)
开发者ID:ctb,项目名称:pony-build,代码行数:3,代码来源:testutil.py


注:本文中的twill.remove_wsgi_intercept函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。