Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
PackageConfig(
specfile_path="fedora/package.spec",
downstream_package_name="package",
create_pr=False,
synced_files=SyncFilesConfig(
files_to_sync=[
SyncFilesItem(
src="fedora/package.spec", dest="fedora/package.spec"
)
]
),
jobs=[
get_job_config_full(
downstream_package_name="package",
specfile_path="fedora/package.spec",
create_pr=False,
synced_files=SyncFilesConfig(
def test_package_config_equal(job_config_simple):
assert PackageConfig(
specfile_path="fedora/package.spec",
synced_files=SyncFilesConfig(
files_to_sync=[SyncFilesItem(src="packit.yaml", dest="packit.yaml")]
),
jobs=[job_config_simple],
downstream_package_name="package",
create_pr=True,
) == PackageConfig(
specfile_path="fedora/package.spec",
synced_files=SyncFilesConfig(
files_to_sync=[SyncFilesItem(src="packit.yaml", dest="packit.yaml")]
),
jobs=[job_config_simple],
downstream_package_name="package",
create_pr=True,
)
PackageConfig(
specfile_path="fedora/package.spec",
spec_source_id="Source3",
jobs=[
get_job_config_build_for_branch(
specfile_path="fedora/package.spec", spec_source_id="Source3",
)
],
),
id="specfile_path+get_job_config_dict_build_for_branch",
),
],
)
def test_package_config_parse(raw, expected):
package_config = PackageConfig.get_from_dict(raw_dict=raw)
assert package_config
# tests for https://github.com/packit-service/packit-service/pull/342
PackageConfig(
specfile_path="fedora/package.spec",
actions={
ActionName.pre_sync: "some/pre-sync/command --option",
ActionName.get_current_version: "get-me-version",
},
jobs=[],
upstream_project_url="https://github.com/asd/qwe",
upstream_package_name="qwe",
dist_git_base_url="https://something.wicked",
downstream_package_name="package",
),
id="specfile_path+actions+empty_jobs+upstream_project_url"
"+upstream_package_name+dist_git_base_url+downstream_package_name",
),
pytest.param(
{
PackageConfig(
specfile_path="fedora/package.spec",
synced_files=SyncFilesConfig([SyncFilesItem(x, x) for x in ("x", "y")]),
actions={ActionName.post_upstream_clone: "ls"},
jobs=[
JobConfig(
type=JobType.build,
trigger=JobConfigTriggerType.release,
specfile_path="somewhere/package.spec",
synced_files=SyncFilesConfig(
[SyncFilesItem(x, x) for x in ("a", "b", "c")]
),
actions={ActionName.create_archive: "ls"},
spec_source_id="Source1",
)
],
),
def test_dist_git_package_url():
di = {
"dist_git_base_url": "https://packit.dev/",
"downstream_package_name": "packit",
"dist_git_namespace": "awesome",
"synced_files": ["fedora/foobar.spec"],
"specfile_path": "fedora/package.spec",
"create_pr": False,
}
new_pc = PackageConfig.get_from_dict(di)
pc = PackageConfig(
dist_git_base_url="https://packit.dev/",
downstream_package_name="packit",
dist_git_namespace="awesome",
synced_files=SyncFilesConfig(
files_to_sync=[
SyncFilesItem(src="fedora/foobar.spec", dest="fedora/foobar.spec")
]
),
specfile_path="fedora/package.spec",
create_pr=False,
jobs=get_default_job_config(
dist_git_base_url="https://packit.dev/",
downstream_package_name="packit",
dist_git_namespace="awesome",
synced_files=SyncFilesConfig(
files_to_sync=[
PackageConfig(
specfile_path="fedora/package.spec",
actions={
ActionName.pre_sync: "some/pre-sync/command --option",
ActionName.get_current_version: "get-me-version",
},
jobs=[],
upstream_project_url="https://github.com/asd/qwe",
upstream_package_name="qwe",
dist_git_base_url="https://something.wicked",
downstream_package_name="package",
spec_source_id="Source1",
),
],
)
def test_serialize_and_deserialize(package_config):
schema = PackageConfigSchema()
def test_package_config_not_equal(not_equal_package_config):
config = PackageConfig(
specfile_path="fedora/package.spec",
synced_files=SyncFilesConfig(
files_to_sync=[
SyncFilesItem(src="c", dest="c"),
SyncFilesItem(src="d", dest="d"),
]
),
jobs=[get_job_config_full()],
create_pr=True,
)
assert config != not_equal_package_config
PackageConfig(
specfile_path="fedora/package.spec",
downstream_package_name="package",
synced_files=SyncFilesConfig(
files_to_sync=[
SyncFilesItem(src="fedora/package.spec", dest="fedora/package.spec")
]
),
jobs=[
get_job_config_full(
specfile_path="fedora/package.spec",
downstream_package_name="package",
synced_files=SyncFilesConfig(
files_to_sync=[
SyncFilesItem(
src="fedora/package.spec", dest="fedora/package.spec"
)