Skip to content

Commit

Permalink
frontend: test chroot skipping
Browse files Browse the repository at this point in the history
  • Loading branch information
FrostyX authored and praiskup committed Nov 20, 2024
1 parent 278af59 commit 7361c52
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions frontend/coprs_frontend/tests/test_logic/test_builds_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,3 +655,43 @@ def save_field(_field, file_path):
build = models.Build.query.get(1)
assert build.source_state == "succeeded"
assert not os.path.exists(storage)

@pytest.mark.parametrize(
"exclusivearch,states", [
(["x86_64", "i386"], ["waiting", "waiting"]),
(["x86_64"], ["waiting", "skipped"]),
([], ["waiting", "waiting"]),
]
)
@pytest.mark.usefixtures(
"f_users", "f_coprs", "f_builds", "f_mock_chroots", "f_db")
def test_skipping_chroots(self, exclusivearch, states):
build = BuildsLogic.add(self.u2, "foo", self.c2)
self.db.session.commit()
assert len(build.chroots) == 0
data = {
"builds": [{
"id": 5,
"task_id": 5,
"srpm_url": "http://foo",
"status": 1,
"pkg_name": "foo",
"pkg_version": 1,
"chroot": "srpm-builds",
"results": {
"epoch": None,
"excludearch": [],
"exclusivearch": exclusivearch,
"name": "biosdevname",
"release": "17",
"version": "0.7.3"
},
}]
}
response = self.tc.post(
"/backend/update/",
headers=self.auth_header,
json=data,
)
assert response.status_code == 200
assert [x.state for x in build.build_chroots] == states

0 comments on commit 7361c52

Please sign in to comment.