Ejemplo n.º 1
0
 def test_path_not_starting_with_slash(self):
     text = "'foo' is not an absolute path @ data['values'][0]"
     try:
         cwd = os.getcwd()
         os.chdir(self.dir.path)
         self.dir.makedir('foo')
         with ShouldFailSchemaWith(text):
             Plugin.schema(dict(type='paths', values=['foo']))
     finally:
         os.chdir(cwd)
Ejemplo n.º 2
0
 def test_schema_ok(self):
     p1 = self.dir.write('foo', b'f')
     p2 = self.dir.write('bar', b'b')
     compare(
         dict(type='paths', values=[p1, p2], repo='config'),
         Plugin.schema(
             dict(type='paths', values=[p1, p2], repo='config')
         ))
Ejemplo n.º 3
0
 def test_path_not_there(self):
     bad_path = self.dir.getpath('bad')
     text = "'%s' does not exist @ data['values'][0]" % bad_path
     with ShouldFailSchemaWith(text):
         Plugin.schema(dict(type='paths', values=[bad_path]))
Ejemplo n.º 4
0
 def test_path_not_string(self):
     text = "expected str @ data['values'][0]"
     with ShouldFailSchemaWith(text):
         Plugin.schema(dict(type='paths', values=[1]))
Ejemplo n.º 5
0
 def test_no_paths(self):
     text = "length of value must be at least 1 for dictionary value " \
            "@ data['values']"
     with ShouldFailSchemaWith(text):
         Plugin.schema(dict(type='paths', values=[]))
Ejemplo n.º 6
0
 def test_name_supplied(self):
     text = "not a valid value for dictionary value @ data['name']"
     with ShouldFailSchemaWith(text):
         Plugin.schema(dict(type='paths', name='foo'))
Ejemplo n.º 7
0
 def test_schema_extra_keys(self):
     with ShouldFailSchemaWith("extra keys not allowed @ data['foo']"):
         Plugin.schema(dict(type='paths', foo='bar'))
Ejemplo n.º 8
0
 def test_schema_wrong_type(self):
     text = "not a valid value for dictionary value @ data['type']"
     with ShouldFailSchemaWith(text):
         Plugin.schema(dict(type='bar', values=['/']))
Ejemplo n.º 9
0
 def test_path_not_there(self):
     text = "invalid list value @ data['values'][0]"
     with ShouldFailSchemaWith(text):
         Plugin.schema(dict(type='paths', values=[self.dir.getpath('bad')]))
Ejemplo n.º 10
0
 def test_path_not_starting_with_slash(self):
     text = "invalid list value @ data['values'][0]"
     with ShouldFailSchemaWith(text):
         Plugin.schema(dict(type='paths', values=['foo']))