Changeset 7345 for cowsserver


Ignore:
Timestamp:
19/08/10 11:02:23 (9 years ago)
Author:
spascoe
Message:

Fixed a bunch of errors exposed by the tests (what few there are).

Several tests are still failing because they are out of date with the codebase.

Location:
cowsserver/branches/migrate-py26-pylons10/lib/cowsserver
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • cowsserver/branches/migrate-py26-pylons10/lib/cowsserver/config/middleware.py

    r7340 r7345  
    7171    static_app = StaticURLParser(config['pylons.paths']['static_files']) 
    7272    app = Cascade([static_app, app]) 
     73    app.config = config 
     74 
    7375    return app 
    7476 
  • cowsserver/branches/migrate-py26-pylons10/lib/cowsserver/tests/__init__.py

    r6096 r7345  
    1313from unittest import TestCase 
    1414 
    15 import pkg_resources 
    16 import paste.fixture 
    17 import paste.script.appinstall 
    1815from paste.deploy import loadapp 
    19 from routes import url_for 
     16from paste.script.appinstall import SetupCommand 
     17from pylons import url 
     18from routes.util import URLGenerator 
     19from webtest import TestApp 
    2020 
    21 __all__ = ['url_for', 'TestController'] 
     21import pylons.test 
    2222 
    23 conf_dir = None 
     23__all__ = ['environ', 'url', 'TestController'] 
    2424 
    25 def setup_tests(): 
    26     global conf_dir 
    27      
    28     here_dir = os.path.dirname(os.path.abspath(__file__)) 
    29     conf_dir = os.path.dirname(os.path.dirname(os.path.dirname(here_dir))) 
    30      
    31     sys.path.insert(0, conf_dir) 
    32     pkg_resources.working_set.add_entry(conf_dir) 
    33     pkg_resources.require('Paste') 
    34     pkg_resources.require('PasteScript') 
    35      
    36     test_file = os.path.join(conf_dir, 'test.ini') 
    37     cmd = paste.script.appinstall.SetupCommand('setup-app') 
    38     cmd.run([test_file]) 
     25# Invoke websetup with the current config file 
     26SetupCommand('setup-app').run([pylons.test.pylonsapp.config['__file__']]) 
     27 
     28environ = {} 
    3929 
    4030class TestController(TestCase): 
    4131 
    4232    def __init__(self, *args, **kwargs): 
    43         wsgiapp = loadapp('config:test.ini', relative_to=conf_dir) 
    44         self.app = paste.fixture.TestApp(wsgiapp) 
     33        wsgiapp = pylons.test.pylonsapp 
     34        config = wsgiapp.config 
     35        self.app = TestApp(wsgiapp) 
     36        url._push_object(URLGenerator(config['routes.map'], environ)) 
    4537        TestCase.__init__(self, *args, **kwargs) 
     38 
  • cowsserver/branches/migrate-py26-pylons10/lib/cowsserver/tests/functional/test_catalogue.py

    r6072 r7345  
    77 
    88    def test_index(self): 
    9         response = self.app.get(url_for(controller='catalogue')) 
     9        response = self.app.get(url(controller='catalogue')) 
    1010        # Test response... 
  • cowsserver/branches/migrate-py26-pylons10/lib/cowsserver/tests/functional/test_coastwms.py

    r6072 r7345  
    99                  'version':'1.1.3'} 
    1010         
    11         response = self.app.get(url_for(controller='coastwms'), params=params) 
     11        response = self.app.get(url(controller='coastwms'), params=params) 
    1212         
    1313        print dir(response) 
  • cowsserver/branches/migrate-py26-pylons10/lib/cowsserver/tests/functional/test_csmlwcs.py

    r6072 r7345  
    55 
    66    def test_index(self): 
    7         response = self.app.get(url_for(controller='coastwms')) 
     7        response = self.app.get(url(controller='coastwms')) 
    88        # Test response... 
  • cowsserver/branches/migrate-py26-pylons10/lib/cowsserver/tests/functional/test_csmlwfs.py

    r6072 r7345  
    55 
    66    def test_index(self): 
    7         response = self.app.get(url_for(controller='csmlwfs')) 
     7        response = self.app.get(url(controller='csmlwfs')) 
    88        # Test response... 
  • cowsserver/branches/migrate-py26-pylons10/lib/cowsserver/tests/functional/test_csmlwms.py

    r6072 r7345  
    44 
    55    def test_index(self): 
    6         response = self.app.get(url_for(controller='csmlwms')) 
     6        response = self.app.get(url(controller='csmlwms')) 
    77        # Test response... 
  • cowsserver/branches/migrate-py26-pylons10/lib/cowsserver/tests/functional/test_demon.py

    r6072 r7345  
    55 
    66    def test_index(self): 
    7         response = self.app.get(url_for(controller='demo')) 
     7        response = self.app.get(url(controller='demo')) 
    88        # Test response... 
Note: See TracChangeset for help on using the changeset viewer.