本文整理汇总了Python中chacra.models.Repo类的典型用法代码示例。如果您正苦于以下问题:Python Repo类的具体用法?Python Repo怎么用?Python Repo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Repo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_ref_does_not_exist
def test_ref_does_not_exist(self, session):
p = Project('foobar')
repo = Repo(
p,
"firefly",
"ubuntu",
"trusty",
)
repo.path = "some_path"
session.commit()
result = session.app.get('/repos/foobar/hammer/ubuntu/trusty/', expect_errors=True)
assert result.status_int == 404
示例2: test_sha1_does_not_exist
def test_sha1_does_not_exist(self, session, url):
p = Project('foobar')
repo = Repo(
p,
"firefly",
"ubuntu",
"trusty",
sha1="head",
)
repo.path = "some_path"
session.commit()
result = session.app.get(url, expect_errors=True)
assert result.status_int == 404
示例3: test_recreate_head
def test_recreate_head(self, session, tmpdir, url):
p = Project('foobar')
repo = Repo(
p,
"firefly",
"ubuntu",
"trusty",
sha1="head",
)
repo.path = "some_path"
session.commit()
result = session.app.head(url)
assert result.status_int == 200
示例4: test_default_flavor
def test_default_flavor(self, session):
p = Project('foobar')
repo = Repo(
p,
"firefly",
"ubuntu",
"trusty",
sha1="head",
)
repo.path = "some_path"
session.commit()
result = session.app.get('/repos/foobar/firefly/head/ubuntu/trusty/flavors/')
assert result.json == ['default']
示例5: test_extra_metadata_default
def test_extra_metadata_default(self, session, url):
p = Project('foobar')
repo = Repo(
p,
"firefly",
"ubuntu",
"trusty",
sha1="head",
)
repo.path = "some_path"
session.commit()
result = session.app.get(url)
assert result.json['extra'] == {}
示例6: test_recreate_head
def test_recreate_head(self, session, tmpdir):
p = Project('foobar')
repo = Repo(
p,
"firefly",
"ubuntu",
"trusty",
)
repo.path = "some_path"
session.commit()
result = session.app.head(
"/repos/foobar/firefly/ubuntu/trusty/recreate"
)
assert result.status_int == 200
示例7: test_single_project_with_built_repos
def test_single_project_with_built_repos(self, session):
p = Project('foobar')
repo = Repo(
p,
"firefly",
"ubuntu",
"trusty",
)
repo.path = "some_path"
session.commit()
result = session.app.get('/repos/')
assert result.status_int == 200
assert len(result.json) == 1
assert result.json == {"foobar": ["firefly"]}
示例8: test_binary_file_deleted_removes_repo
def test_binary_file_deleted_removes_repo(self, session, tmpdir):
# if a repo has no binaries related to it after binary deletion, it is deleted as well
pecan.conf.binary_root = str(tmpdir)
session.app.post(
'/binaries/ceph/giant/ceph/el6/x86_64/',
params={'force': 1},
upload_files=[('file', 'ceph-9.0.0-0.el6.x86_64.rpm', 'hello tharrrr')]
)
repo = Repo.get(1)
assert repo
result = session.app.delete('/binaries/ceph/giant/ceph/el6/x86_64/ceph-9.0.0-0.el6.x86_64.rpm/')
assert result.status_int == 204
repo = Repo.get(1)
assert not repo
示例9: test_single_distro
def test_single_distro(self, session):
p = Project('foobar')
repo = Repo(
p,
"firefly",
"ubuntu",
"trusty",
)
repo.path = "some_path"
session.commit()
result = session.app.get('/repos/foobar/firefly/ubuntu/')
assert result.status_int == 200
assert len(result.json) == 1
assert result.json == ["trusty"]
示例10: test_repo_type
def test_repo_type(self, session, url):
p = Project('foobar')
repo = Repo(
p,
"firefly",
"ubuntu",
"trusty",
sha1="head",
)
repo.path = "some_path"
session.commit()
result = session.app.get(url)
assert result.status_int == 200
assert result.json["type"] is None
示例11: test_repo_exists
def test_repo_exists(self, session):
p = Project('foobar')
repo = Repo(
p,
"firefly",
"ubuntu",
"trusty",
)
repo.path = "some_path"
session.commit()
result = session.app.get('/repos/foobar/firefly/ubuntu/trusty/')
assert result.status_int == 200
assert result.json["distro_version"] == "trusty"
assert result.json["distro"] == "ubuntu"
assert result.json["ref"] == "firefly"
示例12: test_recreate_invalid_path
def test_recreate_invalid_path(self, session, tmpdir, url):
path = str(tmpdir)
invalid_path = os.path.join(path, 'invalid_path')
p = Project('foobar')
repo = Repo(
p,
"firefly",
"ubuntu",
"trusty",
sha1="head",
)
repo.path = invalid_path
session.commit()
result = session.app.post_json(url)
assert os.path.exists(path) is True
assert result.json['needs_update'] is True
示例13: test_recreate
def test_recreate(self, session, tmpdir, url):
path = str(tmpdir)
p = Project('foobar')
repo = Repo(
p,
"firefly",
"ubuntu",
"trusty",
sha1="head",
)
repo.path = path
session.commit()
result = session.app.post_json(url, params={})
assert os.path.exists(path) is False
assert result.json['needs_update'] is True
assert result.json['is_queued'] is False
示例14: test_update_empty_json
def test_update_empty_json(self, session):
p = Project('foobar')
repo = Repo(
p,
"firefly",
"ubuntu",
"trusty",
)
repo.path = "some_path"
session.commit()
result = session.app.post_json(
"/repos/foobar/firefly/ubuntu/trusty/",
params=dict(),
expect_errors=True,
)
assert result.status_int == 400
示例15: test_repo_exists
def test_repo_exists(self, session, url):
p = Project('foobar')
repo = Repo(
p,
"firefly",
"ubuntu",
"trusty",
sha1="head",
)
repo.path = "some_path"
session.commit()
result = session.app.get(url)
assert result.status_int == 200
assert result.json["distro_version"] == "trusty"
assert result.json["distro"] == "ubuntu"
assert result.json["ref"] == "firefly"
assert result.json["sha1"] == "head"