Example #1
0
def test_list_uses_of_pkgs(so, names, rpms_for_package, rpms_for_image,
                           rhcos_rpms, expect_to_say, expect_not_to_say):
    major, minor = "4", "0"
    search_type = "package" if rpms_for_package else "rpm"

    flexmock(brew_list).should_receive("_koji_client_session").and_return(
        object())
    flexmock(brew_list).should_receive("_find_rpms_in_packages").and_return(
        rpms_for_package)
    flexmock(brew_list).should_receive("latest_images_for_version").and_return(
        rpms_for_image.keys())
    flexmock(brew_list, brew_list_components=lambda nvr: rpms_for_image[nvr])
    flexmock(brew_list).should_receive("_find_rhcos_build_rpms").and_return(
        rhcos_rpms)

    brew_list.list_uses_of_rpms(so, names, major, minor, search_type)
    for phrase in expect_to_say:
        assert phrase in so.said
    for phrase in expect_not_to_say:
        assert phrase not in so.said
Example #2
0
def test_list_uses_of_rpms_brew_failure(so):
    flexmock(brew_list).should_receive("_koji_client_session").and_raise(
        Exception("bork"))
    brew_list.list_uses_of_rpms(so, "spam", "4", "0")
    assert "bork" in so.said_monitoring
    assert "Failed to connect to brew" in so.said
Example #3
0
def test_list_uses_of_rpms_unknown_packages(so):
    flexmock(brew_list).should_receive("_koji_client_session").and_return(
        object())
    flexmock(brew_list).should_receive("_find_rpms_in_packages").and_return({})
    brew_list.list_uses_of_rpms(so, "spam", "4", "0", "package")
    assert "Could not find any package" in so.said
Example #4
0
def test_list_uses_of_rpms_invalid_name(so):
    brew_list.list_uses_of_rpms(so, ",,,,", "4", "0", search_type="RPM")
    assert "Invalid RPM name" in so.said