Example #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"]))
Example #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
Example #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']))
Example #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']))
Example #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
Example #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
Example #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
Example #8
0
 def test_available_apps_empty(self):
     loader = DirectoryConfLoader(self.dir)
     eq_(loader.available_apps(), [])
Example #9
0
 def setup(self):
     self.dir = tempfile.mkdtemp()
     self.loader = DirectoryConfLoader(self.dir)
Example #10
0
 def test_custom_suffix(self):
     self.make_conf_file('foo.conf')
     loader = DirectoryConfLoader(self.dir, suffix='.conf')
     assert loader.app_available('foo')
Example #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)
Example #12
0
 def test_available_apps_empty(self):
     loader = DirectoryConfLoader(self.dir)
     eq_(loader.available_apps(), [])
Example #13
0
 def loader(self, tmpdir):
     return DirectoryConfLoader(tmpdir.strpath)
Example #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")
Example #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)
Example #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")
Example #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')
Example #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')
Example #19
0
 def test_app_conf_unknown_app(self):
     loader = DirectoryConfLoader(self.dir)
     app_conf = loader.app_conf('foo')
     assert app_conf is None
Example #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)
Example #21
0
 def test_custom_suffix(self):
     self.make_conf_file('foo.conf')
     loader = DirectoryConfLoader(self.dir, suffix='.conf')
     assert loader.app_available('foo')
Example #22
0
 def test_app_conf_unknown_app(self):
     loader = DirectoryConfLoader(self.dir)
     app_conf = loader.app_conf('foo')
     assert app_conf is None