Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(272)  |  Call(223)  |  Derive(0)  |  Import(49)

            @wraps(func)
    def helper(*args, **kwds):
        return GeneratorContextManager(func(*args, **kwds))
        


src/m/a/MapProxy-1.6.0/mapproxy/test/system/test_wms.py   MapProxy(Download)
                                 wms_request
from mapproxy.test.image import is_jpeg, is_png, tmp_image, create_tmp_image
from mapproxy.test.http import mock_httpd
from mapproxy.test.helper import validate_with_dtd, validate_with_xsd
from nose.tools import eq_, assert_almost_equal
                          '&WIDTH=200'},
                            {'body': 'notanimage', 'headers': {'content-type': 'image/jpeg'}})
        with mock_httpd(('localhost', 42423), [expected_req]):
            resp = self.app.get(self.common_map_req)
            eq_(resp.content_type, 'application/vnd.ogc.se_xml')
                                      '&WIDTH=256'},
                            {'body': img.read(), 'headers': {'content-type': 'image/jpeg'}})
            with mock_httpd(('localhost', 42423), [expected_req]):
                self.common_map_req.params['bbox'] = '0,0,180,90'
                resp = self.app.get(self.common_map_req)
                                  '&WIDTH=256'},
                        {'body': 'notanimage', 'headers': {'content-type': 'image/jpeg'}})
        with mock_httpd(('localhost', 42423), [expected_req]):
            self.common_map_req.params['bbox'] = '0,0,180,90'
            resp = self.app.get(self.common_map_req)
                                    '&WIDTH=200&TIME=20041012'},
                        {'body': img})
        with mock_httpd(('localhost', 42423), [expected_req]):
            self.common_map_req.params['layers'] = 'direct_fwd_params'
            self.common_map_req.params['time'] = '20041012'

src/m/a/mapproxy-HEAD/mapproxy/test/system/test_wms.py   mapproxy(Download)
                                 wms_request
from mapproxy.test.image import is_jpeg, is_png, tmp_image, create_tmp_image
from mapproxy.test.http import mock_httpd
from mapproxy.test.helper import validate_with_dtd, validate_with_xsd
from nose.tools import eq_, assert_almost_equal
                          '&WIDTH=200'},
                            {'body': 'notanimage', 'headers': {'content-type': 'image/jpeg'}})
        with mock_httpd(('localhost', 42423), [expected_req]):
            resp = self.app.get(self.common_map_req)
            eq_(resp.content_type, 'application/vnd.ogc.se_xml')
                                      '&WIDTH=256'},
                            {'body': img.read(), 'headers': {'content-type': 'image/jpeg'}})
            with mock_httpd(('localhost', 42423), [expected_req]):
                self.common_map_req.params['bbox'] = '0,0,180,90'
                resp = self.app.get(self.common_map_req)
                                  '&WIDTH=256'},
                        {'body': 'notanimage', 'headers': {'content-type': 'image/jpeg'}})
        with mock_httpd(('localhost', 42423), [expected_req]):
            self.common_map_req.params['bbox'] = '0,0,180,90'
            resp = self.app.get(self.common_map_req)
                                    '&WIDTH=200&TIME=20041012'},
                        {'body': img})
        with mock_httpd(('localhost', 42423), [expected_req]):
            self.common_map_req.params['layers'] = 'direct_fwd_params'
            self.common_map_req.params['time'] = '20041012'

src/m/a/MapProxy-1.6.0/mapproxy/test/system/test_cache_source.py   MapProxy(Download)
from mapproxy.request.wms import WMS111MapRequest
from mapproxy.test.image import tmp_image
from mapproxy.test.http import mock_httpd
from mapproxy.test.system import module_setup, module_teardown, SystemTest, make_base_config
from nose.tools import eq_
                    ({'path': r'/tiles/%02d/000/000/%03d/000/000/%03d.png' % (tile[2], tile[0], tile[1])},
                     {'body': img, 'headers': {'content-type': 'image/png'}}))
            with mock_httpd(('localhost', 42423), expected_reqs, unordered=True):
                resp = self.app.get(map_req)
                eq_(resp.content_type, 'image/png')
                    ({'path': r'/tiles/%02d/000/000/%03d/000/000/%03d.png' % (tile[2], tile[0], tile[1])},
                     {'body': img.read(), 'headers': {'content-type': 'image/png'}}))
            with mock_httpd(('localhost', 42423), expected_reqs, unordered=True):
                resp = self.app.get('/tms/1.0.0/tms_transf/EPSG25832/0/0/0.png')
                eq_(resp.content_type, 'image/png')
                     {'body': img, 'headers': {'content-type': 'image/png'}}))
 
            with mock_httpd(('localhost', 42423), expected_reqs, unordered=True):
                resp = self.app.get('/tms/1.0.0/combined/EPSG25832/0/0/0.png')
                eq_(resp.content_type, 'image/png')

src/m/a/mapproxy-HEAD/mapproxy/test/system/test_cache_source.py   mapproxy(Download)
from mapproxy.request.wms import WMS111MapRequest
from mapproxy.test.image import tmp_image
from mapproxy.test.http import mock_httpd
from mapproxy.test.system import module_setup, module_teardown, SystemTest, make_base_config
from nose.tools import eq_
                    ({'path': r'/tiles/%02d/000/000/%03d/000/000/%03d.png' % (tile[2], tile[0], tile[1])},
                     {'body': img, 'headers': {'content-type': 'image/png'}}))
            with mock_httpd(('localhost', 42423), expected_reqs, unordered=True):
                resp = self.app.get(map_req)
                eq_(resp.content_type, 'image/png')
                    ({'path': r'/tiles/%02d/000/000/%03d/000/000/%03d.png' % (tile[2], tile[0], tile[1])},
                     {'body': img.read(), 'headers': {'content-type': 'image/png'}}))
            with mock_httpd(('localhost', 42423), expected_reqs, unordered=True):
                resp = self.app.get('/tms/1.0.0/tms_transf/EPSG25832/0/0/0.png')
                eq_(resp.content_type, 'image/png')
                     {'body': img, 'headers': {'content-type': 'image/png'}}))
 
            with mock_httpd(('localhost', 42423), expected_reqs, unordered=True):
                resp = self.app.get('/tms/1.0.0/combined/EPSG25832/0/0/0.png')
                eq_(resp.content_type, 'image/png')

src/m/a/MapProxy-1.6.0/mapproxy/test/system/test_seed.py   MapProxy(Download)
from mapproxy.util.fs import ensure_directory
 
from mapproxy.test.http import mock_httpd
from mapproxy.test.image import tmp_image, create_tmp_image_buf, create_tmp_image
 
                                  '&width=256&height=128&srs=EPSG:4326'},
                            {'body': img_data, 'headers': {'content-type': 'image/png'}})
            with mock_httpd(('localhost', 42423), [expected_req]):
                with local_base_config(self.mapproxy_conf.base_config):
                    seed_conf  = load_seed_tasks_conf(self.seed_conf_file, self.mapproxy_conf)
                                  '&width=256&height=128&srs=EPSG:4326'},
                            {'body': img_data, 'headers': {'content-type': 'image/png'}})
            with mock_httpd(('localhost', 42423), [expected_req]):
                seed_conf  = load_seed_tasks_conf(self.seed_conf_file, self.mapproxy_conf)
                tasks, cleanup_tasks = seed_conf.seeds(), seed_conf.cleanups()
                                  '&width=256&height=128&srs=EPSG:4326'},
                            {'body': img_data, 'headers': {'content-type': 'image/png'}})
            with mock_httpd(('localhost', 42423), [expected_req]):
                seed_conf  = load_seed_tasks_conf(self.seed_conf_file, self.mapproxy_conf)
                tasks, cleanup_tasks = seed_conf.seeds(['mbtile_cache']), seed_conf.cleanups(['cleanup_mbtile_cache'])
                          '&width=256&height=128&srs=EPSG:4326'},
                        {'body': tile_image, 'headers': {'content-type': 'image/png'}})
        with mock_httpd(('localhost', 42423), [expected_req]):
            # mbtiles does not support timestamps, refresh all tiles
            seed(tasks, dry_run=False)

src/m/a/mapproxy-HEAD/mapproxy/test/system/test_seed.py   mapproxy(Download)
from mapproxy.util.fs import ensure_directory
 
from mapproxy.test.http import mock_httpd
from mapproxy.test.image import tmp_image, create_tmp_image_buf, create_tmp_image
 
                                  '&width=256&height=128&srs=EPSG:4326'},
                            {'body': img_data, 'headers': {'content-type': 'image/png'}})
            with mock_httpd(('localhost', 42423), [expected_req]):
                with local_base_config(self.mapproxy_conf.base_config):
                    seed_conf  = load_seed_tasks_conf(self.seed_conf_file, self.mapproxy_conf)
                                  '&width=256&height=128&srs=EPSG:4326'},
                            {'body': img_data, 'headers': {'content-type': 'image/png'}})
            with mock_httpd(('localhost', 42423), [expected_req]):
                seed_conf  = load_seed_tasks_conf(self.seed_conf_file, self.mapproxy_conf)
                tasks, cleanup_tasks = seed_conf.seeds(), seed_conf.cleanups()
                                  '&width=256&height=128&srs=EPSG:4326'},
                            {'body': img_data, 'headers': {'content-type': 'image/png'}})
            with mock_httpd(('localhost', 42423), [expected_req]):
                seed_conf  = load_seed_tasks_conf(self.seed_conf_file, self.mapproxy_conf)
                tasks, cleanup_tasks = seed_conf.seeds(['mbtile_cache']), seed_conf.cleanups(['cleanup_mbtile_cache'])
                          '&width=256&height=128&srs=EPSG:4326'},
                        {'body': tile_image, 'headers': {'content-type': 'image/png'}})
        with mock_httpd(('localhost', 42423), [expected_req]):
            # mbtiles does not support timestamps, refresh all tiles
            seed(tasks, dry_run=False)

src/m/a/MapProxy-1.6.0/mapproxy/test/system/test_util_export.py   MapProxy(Download)
from mapproxy.script.export import export_command
from mapproxy.test.image import tmp_image
from mapproxy.test.http import mock_httpd
 
FIXTURE_DIR = os.path.join(os.path.dirname(__file__), 'fixture')
            ({'path': r'/tiles/%d/%d/%d.png' % (tile[2], tile[0], tile[1])},
             {'body': img, 'headers': {'content-type': 'image/png'}}))
    with mock_httpd(('localhost', 42423), expected_reqs, unordered=True):
        yield
 

src/m/a/mapproxy-HEAD/mapproxy/test/system/test_util_export.py   mapproxy(Download)
from mapproxy.script.export import export_command
from mapproxy.test.image import tmp_image
from mapproxy.test.http import mock_httpd
 
FIXTURE_DIR = os.path.join(os.path.dirname(__file__), 'fixture')
            ({'path': r'/tiles/%d/%d/%d.png' % (tile[2], tile[0], tile[1])},
             {'body': img, 'headers': {'content-type': 'image/png'}}))
    with mock_httpd(('localhost', 42423), expected_reqs, unordered=True):
        yield
 

src/m/a/MapProxy-1.6.0/mapproxy/test/unit/test_client.py   MapProxy(Download)
from mapproxy.srs import SRS
from mapproxy.test.unit.test_cache import MockHTTPClient
from mapproxy.test.http import mock_httpd, query_eq, assert_query_eq
from mapproxy.test.helper import assert_re, TempFile
 
    def test_post(self):
        with mock_httpd(TESTSERVER_ADDRESS, [({'path': '/service?foo=bar', 'method': 'POST'},
                                              {'status': '200', 'body': ''})]):
            self.client.open(TESTSERVER_URL + '/service', data="foo=bar")
 
    def test_internal_error_response(self):
        try:
            with mock_httpd(TESTSERVER_ADDRESS, [({'path': '/'},
        client1 = HTTPClient(timeout=0.1)
        client2 = HTTPClient(timeout=0.2)
        with mock_httpd(TESTSERVER_ADDRESS, [test_req]):
            try:
                start = time.time()
            duration1 = time.time() - start
 
        with mock_httpd(TESTSERVER_ADDRESS, [test_req]):
            try:
                start = time.time()

src/m/a/mapproxy-HEAD/mapproxy/test/unit/test_client.py   mapproxy(Download)
from mapproxy.srs import SRS
from mapproxy.test.unit.test_cache import MockHTTPClient
from mapproxy.test.http import mock_httpd, query_eq, assert_query_eq
from mapproxy.test.helper import assert_re, TempFile
 
    def test_post(self):
        with mock_httpd(TESTSERVER_ADDRESS, [({'path': '/service?foo=bar', 'method': 'POST'},
                                              {'status': '200', 'body': ''})]):
            self.client.open(TESTSERVER_URL + '/service', data="foo=bar")
 
    def test_internal_error_response(self):
        try:
            with mock_httpd(TESTSERVER_ADDRESS, [({'path': '/'},
        client1 = HTTPClient(timeout=0.1)
        client2 = HTTPClient(timeout=0.2)
        with mock_httpd(TESTSERVER_ADDRESS, [test_req]):
            try:
                start = time.time()
            duration1 = time.time() - start
 
        with mock_httpd(TESTSERVER_ADDRESS, [test_req]):
            try:
                start = time.time()

  1 | 2 | 3 | 4 | 5  Next