Ejemplo n.º 1
0
 def read_and_validate_invalid_config(
     x=list_(of=str_(of='abc123_', max_length=20),
             min_length=0, max_length=5),
     y=list_(of=str_(of='abc123_', max_length=20),
             min_length=6, max_length=10)
 ):
     with MockTransaction:
         test_config = dict(zip(x, x))
         paths = [config.DEFAILT_CONFIG_PATH, config.CONFIG_PATH]
         expect(config).read_config(paths).and_return(test_config).once()
         expect(config).validate_config(test_config, y). \
             and_return(False).once()
         try:
             config.read_and_validate_config(paths, y)
         except KeyError:
             assert True
         else:
             assert False
Ejemplo n.º 2
0
 def read_and_validate_valid_config(
     x=list_(of=str_(of='abc123_', max_length=20),
             min_length=0, max_length=10)
 ):
     with MockTransaction:
         test_config = dict(zip(x, x))
         paths = ['path1', 'path2']
         expect(config).read_config(paths).and_return(test_config).once()
         expect(config).validate_config(test_config, x). \
             and_return(True).once()
         assert config.read_and_validate_config(paths, x) == test_config