Пример #1
0
 def test_validate_failure_against_location(self):
     invalid_fixture()
     shutil.copytree(get_specs_path(), self.temp_dir)
     # Here, the client does the validation, so we instead get a
     # ValidationException directly from schemer
     with self.assertRaises(ValidationException):
         self.run_command('validate {}'.format(self.temp_dir))
Пример #2
0
def _write(spec_type, name, spec_doc):
    spec_type_path = os.path.join(get_specs_path(), '{}s'.format(spec_type))
    try:
        os.makedirs(spec_type_path)
    except OSError:
        pass
    with open(os.path.join(spec_type_path, '{}.yml'.format(name)), 'w') as f:
        f.write(yaml.dump(spec_doc, default_flow_style=False))
Пример #3
0
def _write(spec_type, name, spec_doc):
    spec_type_path = os.path.join(get_specs_path(), '{}s'.format(spec_type))

    try:
        os.makedirs(spec_type_path)
    except OSError:
        pass

    spec_path = os.path.join(spec_type_path, '{}.yml'.format(name))
    if os.path.exists(spec_path):
        os.remove(spec_path)
    with open(spec_path, 'w') as f:
        f.write(yaml.safe_dump(spec_doc, default_flow_style=False))

    if 'repo' in spec_doc:
        repo = Repo(spec_doc['repo'])
        if repo.is_local_repo:
            set_up_fake_local_repo('/{}'.format(repo.rel_path))
Пример #4
0
def _write(spec_type, name, spec_doc):
    spec_type_path = os.path.join(get_specs_path(), '{}s'.format(spec_type))

    try:
        os.makedirs(spec_type_path)
    except OSError:
        pass

    spec_path = os.path.join(spec_type_path, '{}.yml'.format(name))
    if os.path.exists(spec_path):
        os.remove(spec_path)
    with open(spec_path, 'w') as f:
        f.write(yaml.safe_dump(spec_doc, default_flow_style=False))

    if 'repo' in spec_doc:
        repo = Repo(spec_doc['repo'])
        if repo.is_local_repo:
            set_up_fake_local_repo('/{}'.format(repo.rel_path))
Пример #5
0
 def test_validate_success_against_location(self):
     shutil.copytree(get_specs_path(), self.temp_dir)
     self.run_command('validate {}'.format(self.temp_dir))