Пример #1
0
def test_get_srpm_logs(client):
    srpm_build = SRPMBuildModel()
    srpm_build.id = 2
    srpm_build.logs = "asd\nqwe"

    flexmock(SRPMBuildModel).should_receive("get_by_id").and_return(srpm_build)

    url = "/srpm-build/2/logs"
    logs_url = get_srpm_log_url_from_flask(2)
    assert logs_url.endswith(url)

    resp = client.get(url).data.decode()
    assert srpm_build.logs in resp
    assert f"build {srpm_build.id}" in resp
Пример #2
0
def test_get_srpm_logs(client):
    srpm_build = SRPMBuildModel()
    srpm_build.id = 2
    srpm_build.logs = "asd\nqwe"

    flexmock(SRPMBuildModel).should_receive("get_by_id").and_return(srpm_build)

    url = f"/srpm-build/2/logs"
    logs_url = get_srpm_log_url(2)
    assert logs_url.endswith(url)

    resp = client.get(url)
    expected = ("<html><head>"
                "<title>SRPM Build id=2</title></head><body>"
                "SRPM creation logs:<br><br>"
                "<pre>asd\nqwe</pre>"
                "<br></body></html>")
    assert resp.data == expected.encode()