本文整理汇总了Python中chacra.models.Repo.get方法的典型用法代码示例。如果您正苦于以下问题:Python Repo.get方法的具体用法?Python Repo.get怎么用?Python Repo.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类chacra.models.Repo
的用法示例。
在下文中一共展示了Repo.get方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_binary_file_deleted_removes_repo
# 需要导入模块: from chacra.models import Repo [as 别名]
# 或者: from chacra.models.Repo import get [as 别名]
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
示例2: test_update
# 需要导入模块: from chacra.models import Repo [as 别名]
# 或者: from chacra.models.Repo import get [as 别名]
def test_update(self, session, tmpdir):
p = Project('foobar')
repo = Repo(
p,
"firefly",
"ubuntu",
"trusty",
)
repo.path = "some_path"
session.commit()
repo.get(1)
repo.needs_update = False
session.commit()
result = session.app.post_json(
"/repos/foobar/firefly/ubuntu/trusty/update",
params={}
)
assert result.json['needs_update'] is True
示例3: test_deb_is_inferred
# 需要导入模块: from chacra.models import Repo [as 别名]
# 或者: from chacra.models.Repo import get [as 别名]
def test_deb_is_inferred(self, session):
binary = Binary(
'ceph-1.0.deb',
self.p,
distro='ubuntu',
distro_version='trusty',
arch='x86_64',
)
session.commit()
repo = Repo.get(1)
assert repo.infer_type() == 'deb'
示例4: test_rpm_is_inferred
# 需要导入模块: from chacra.models import Repo [as 别名]
# 或者: from chacra.models.Repo import get [as 别名]
def test_rpm_is_inferred(self, session):
binary = Binary(
'ceph-1.0.rpm',
self.p,
distro='centos',
distro_version='7',
arch='x86_64',
)
session.commit()
repo = Repo.get(1)
assert repo.infer_type() == 'rpm'
示例5: test_update
# 需要导入模块: from chacra.models import Repo [as 别名]
# 或者: from chacra.models.Repo import get [as 别名]
def test_update(self, session, tmpdir, url):
p = Project('foobar')
repo = Repo(
p,
"firefly",
"ubuntu",
"trusty",
sha1="head",
)
repo.path = "some_path"
session.commit()
repo.get(1)
repo.needs_update = False
session.commit()
result = session.app.post_json(
url,
params={}
)
assert result.json['needs_update'] is True
assert result.json['is_queued'] is False
示例6: test_binary_sets_repo_type
# 需要导入模块: from chacra.models import Repo [as 别名]
# 或者: from chacra.models.Repo import get [as 别名]
def test_binary_sets_repo_type(self, session):
repo = Repo(self.p, 'hammer', 'centos', '7')
session.commit()
binary = Binary(
'ceph-1.0.rpm',
self.p,
ref='hammer',
distro='centos',
distro_version='7',
arch='x86_64',
)
session.commit()
repo = Repo.get(1)
assert repo.type == 'rpm'
示例7: test_update_triggers_a_change_in_modified
# 需要导入模块: from chacra.models import Repo [as 别名]
# 或者: from chacra.models.Repo import get [as 别名]
def test_update_triggers_a_change_in_modified(self, session):
initial_repo = Repo(
self.p,
ref='firefly',
distro='centos',
distro_version='7',
)
initial_timestamp = initial_repo.modified.time()
session.commit()
repo = Repo.get(1)
repo.distro = 'rhel'
session.commit()
assert initial_timestamp < repo.modified.time()
示例8: test_recreate_and_requeue
# 需要导入模块: from chacra.models import Repo [as 别名]
# 或者: from chacra.models.Repo import get [as 别名]
def test_recreate_and_requeue(self, session, tmpdir, url):
path = str(tmpdir)
p = Project('foobar')
repo = Repo(
p,
"firefly",
"ubuntu",
"trusty",
sha1="head",
)
repo.path = path
session.commit()
repo = Repo.get(1)
repo.is_queued = True
session.commit()
result = session.app.post_json(url)
assert os.path.exists(path) is False
assert result.json['needs_update'] is True
assert result.json['is_queued'] is False
示例9: test_add_extra_metadata
# 需要导入模块: from chacra.models import Repo [as 别名]
# 或者: from chacra.models.Repo import get [as 别名]
def test_add_extra_metadata(self, session, url):
p = Project('foobar')
repo = Repo(
p,
"firefly",
"ubuntu",
"trusty",
sha1="head",
)
repo.path = "some_path"
session.commit()
repo_id = repo.id
data = {'version': '0.94.8', 'distros': ['precise']}
session.app.post_json(
url,
params=data,
)
updated_repo = Repo.get(repo_id)
assert updated_repo.extra == {"version": "0.94.8", 'distros': ['precise']}
示例10: test_update_single_field
# 需要导入模块: from chacra.models import Repo [as 别名]
# 或者: from chacra.models.Repo import get [as 别名]
def test_update_single_field(self, session):
p = Project('foobar')
repo = Repo(
p,
"firefly",
"ubuntu",
"trusty",
)
repo.path = "some_path"
session.commit()
repo_id = repo.id
data = {"distro_version": "precise"}
result = session.app.post_json(
"/repos/foobar/firefly/ubuntu/trusty/",
params=data,
)
assert result.status_int == 200
updated_repo = Repo.get(repo_id)
assert updated_repo.distro_version == "precise"
assert result.json['distro_version'] == "precise"
示例11: test_update_invalid_fields
# 需要导入模块: from chacra.models import Repo [as 别名]
# 或者: from chacra.models.Repo import get [as 别名]
def test_update_invalid_fields(self, session):
p = Project('foobar')
repo = Repo(
p,
"firefly",
"ubuntu",
"trusty",
)
repo.path = "some_path"
session.commit()
repo_id = repo.id
data = {"bogus": "7", "distro": "centos"}
result = session.app.post_json(
"/repos/foobar/firefly/ubuntu/trusty/",
params=data,
expect_errors=True,
)
assert result.status_int == 400
updated_repo = Repo.get(repo_id)
assert updated_repo.distro == "ubuntu"
示例12: test_update_multiple_fields
# 需要导入模块: from chacra.models import Repo [as 别名]
# 或者: from chacra.models.Repo import get [as 别名]
def test_update_multiple_fields(self, session, url):
p = Project('foobar')
repo = Repo(
p,
"firefly",
"ubuntu",
"trusty",
sha1="head",
)
repo.path = "some_path"
session.commit()
repo_id = repo.id
data = {"distro_version": "7", "distro": "centos"}
result = session.app.post_json(
url,
params=data,
)
assert result.status_int == 200
updated_repo = Repo.get(repo_id)
assert updated_repo.distro_version == "7"
assert updated_repo.distro == "centos"
assert result.json['distro_version'] == "7"
assert result.json['distro'] == "centos"