Exemplo n.º 1
0
 def test_available_apps(self):
     self.make_conf_file("foo.yaml")
     self.make_conf_file("bar.yaml")
     loader = DirectoryConfLoader(self.dir)
     eq_(set(loader.available_apps()), set(["foo", "bar"]))
     self.make_conf_file("bazz.yaml")
     eq_(set(loader.available_apps()), set(["foo", "bar", "bazz"]))
Exemplo n.º 2
0
    def test_needs_reload(self):
        foo_conf_file = self.make_conf_file("foo.yaml")
        mtime = os.path.getmtime(foo_conf_file)
        loader = DirectoryConfLoader(self.dir)
        assert loader.needs_reload("foo", mtime) == False

        assert loader.needs_reload("foo", mtime - 10) == True
Exemplo n.º 3
0
 def test_available_apps(self):
     self.make_conf_file('foo.yaml')
     self.make_conf_file('bar.yaml')
     loader = DirectoryConfLoader(self.dir)
     eq_(set(loader.available_apps()), set(['foo', 'bar']))
     self.make_conf_file('bazz.yaml')
     eq_(set(loader.available_apps()), set(['foo', 'bar', 'bazz']))
Exemplo n.º 4
0
 def test_available_apps(self):
     self.make_conf_file('foo.yaml')
     self.make_conf_file('bar.yaml')
     loader = DirectoryConfLoader(self.dir)
     eq_(set(loader.available_apps()), set(['foo', 'bar']))
     self.make_conf_file('bazz.yaml')
     eq_(set(loader.available_apps()), set(['foo', 'bar', 'bazz']))
Exemplo n.º 5
0
    def test_needs_reload(self):
        foo_conf_file = self.make_conf_file('foo.yaml')
        mtime = os.path.getmtime(foo_conf_file)
        loader = DirectoryConfLoader(self.dir)
        assert loader.needs_reload('foo', mtime) == False

        assert loader.needs_reload('foo', mtime - 10) == True
Exemplo n.º 6
0
    def test_needs_reload(self):
        foo_conf_file = self.make_conf_file('foo.yaml')
        mtime = os.path.getmtime(foo_conf_file)
        timestamps = {foo_conf_file: mtime}
        loader = DirectoryConfLoader(self.dir)
        assert loader.needs_reload('foo', timestamps) == False

        timestamps[foo_conf_file] -= 10
        assert loader.needs_reload('foo', timestamps) == True
Exemplo n.º 7
0
    def test_needs_reload(self):
        foo_conf_file = self.make_conf_file('foo.yaml')
        mtime = os.path.getmtime(foo_conf_file)
        timestamps = {foo_conf_file: mtime}
        loader = DirectoryConfLoader(self.dir)
        assert loader.needs_reload('foo', timestamps) == False

        timestamps[foo_conf_file] -= 10
        assert loader.needs_reload('foo', timestamps) == True
Exemplo n.º 8
0
 def test_available_apps_empty(self):
     loader = DirectoryConfLoader(self.dir)
     eq_(loader.available_apps(), [])
Exemplo n.º 9
0
 def setup(self):
     self.dir = tempfile.mkdtemp()
     self.loader = DirectoryConfLoader(self.dir)
Exemplo n.º 10
0
 def test_custom_suffix(self):
     self.make_conf_file('foo.conf')
     loader = DirectoryConfLoader(self.dir, suffix='.conf')
     assert loader.app_available('foo')
Exemplo n.º 11
0
 def test_app_conf(self):
     foo_conf_file = self.make_conf_file('foo.yaml')
     loader = DirectoryConfLoader(self.dir)
     app_conf = loader.app_conf('foo')
     eq_(app_conf['mapproxy_conf'], foo_conf_file)
Exemplo n.º 12
0
 def test_available_apps_empty(self):
     loader = DirectoryConfLoader(self.dir)
     eq_(loader.available_apps(), [])
Exemplo n.º 13
0
 def loader(self, tmpdir):
     return DirectoryConfLoader(tmpdir.strpath)
Exemplo n.º 14
0
 def test_custom_suffix(self, loader):
     self.make_conf_file(loader.base_dir, "foo.conf")
     loader = DirectoryConfLoader(loader.base_dir, suffix=".conf")
     assert loader.app_available("foo")
Exemplo n.º 15
0
 def test_app_conf(self):
     foo_conf_file = self.make_conf_file("foo.yaml")
     loader = DirectoryConfLoader(self.dir)
     app_conf = loader.app_conf("foo")
     eq_(app_conf["mapproxy_conf"], foo_conf_file)
Exemplo n.º 16
0
 def test_app_available(self):
     self.make_conf_file("foo.yaml")
     loader = DirectoryConfLoader(self.dir)
     assert loader.app_available("foo")
     assert not loader.app_available("bar")
Exemplo n.º 17
0
 def test_app_available(self):
     self.make_conf_file('foo.yaml')
     loader = DirectoryConfLoader(self.dir)
     assert loader.app_available('foo')
     assert not loader.app_available('bar')
Exemplo n.º 18
0
 def test_app_available(self):
     self.make_conf_file('foo.yaml')
     loader = DirectoryConfLoader(self.dir)
     assert loader.app_available('foo')
     assert not loader.app_available('bar')
Exemplo n.º 19
0
 def test_app_conf_unknown_app(self):
     loader = DirectoryConfLoader(self.dir)
     app_conf = loader.app_conf('foo')
     assert app_conf is None
Exemplo n.º 20
0
 def test_app_conf(self):
     foo_conf_file = self.make_conf_file('foo.yaml')
     loader = DirectoryConfLoader(self.dir)
     app_conf = loader.app_conf('foo')
     eq_(app_conf['mapproxy_conf'], foo_conf_file)
Exemplo n.º 21
0
 def test_custom_suffix(self):
     self.make_conf_file('foo.conf')
     loader = DirectoryConfLoader(self.dir, suffix='.conf')
     assert loader.app_available('foo')
Exemplo n.º 22
0
 def test_app_conf_unknown_app(self):
     loader = DirectoryConfLoader(self.dir)
     app_conf = loader.app_conf('foo')
     assert app_conf is None