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"]))
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
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']))
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
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
def test_available_apps_empty(self): loader = DirectoryConfLoader(self.dir) eq_(loader.available_apps(), [])
def setup(self): self.dir = tempfile.mkdtemp() self.loader = DirectoryConfLoader(self.dir)
def test_custom_suffix(self): self.make_conf_file('foo.conf') loader = DirectoryConfLoader(self.dir, suffix='.conf') assert loader.app_available('foo')
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)
def loader(self, tmpdir): return DirectoryConfLoader(tmpdir.strpath)
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")
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)
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")
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')
def test_app_conf_unknown_app(self): loader = DirectoryConfLoader(self.dir) app_conf = loader.app_conf('foo') assert app_conf is None