Beispiel #1
0
def test_already_linked(env):
    results_obj = fx_only_failure()
    results_obj.test_results["/test/test.html"].bug_links.append(
        MetaLink(None, "%s/show_bug.cgi?id=10000" % (env.bz.bz_url, ),
                 "firefox", "/test/test.html", None, None))
    sync = Mock()
    sync.lock_key = ("downstream", None)
    sync.notify_bugs = FrozenDict()
    env.config["notify"][
        "components"] = "Foo :: Bar, Testing :: web-platform-tests"
    with patch(
            "sync.notify.bugs.components_for_wpt_paths",
            return_value={"Testing :: web-platform-tests":
                          ["test/test.html"]}):
        with patch("sync.notify.bugs.test_ids_to_paths",
                   return_value={
                       "testing/web-platform/tests/test/test.html":
                       ["/test/test.html"]
                   }):
            bug_data = bugs.for_sync(sync, results_obj)

    assert len(bug_data) == 0

    assert ("Creating a bug in component Testing :: web-platform-tests"
            not in env.bz.output.getvalue())
Beispiel #2
0
def test_crash(env):
    results_obj = fx_crash()
    sync = Mock()
    sync.lock_key = ("downstream", None)
    sync.notify_bugs = FrozenDict()
    env.config["notify"][
        "components"] = "Foo :: Bar, Testing :: web-platform-tests"
    with patch(
            "sync.notify.bugs.components_for_wpt_paths",
            return_value={"Testing :: web-platform-tests":
                          ["test/test.html"]}):
        with patch("sync.notify.bugs.test_ids_to_paths",
                   return_value={
                       "testing/web-platform/tests/test/test.html":
                       ["/test/test.html"]
                   }):
            bug_data = bugs.for_sync(sync, results_obj)

    assert list(bug_data.values()) == [[
        ("/test/test.html", None, results_obj.test_results["/test/test.html"],
         "CRASH")
    ]]

    assert "Creating a bug in component Testing :: web-platform-tests" in env.bz.output.getvalue(
    )
Beispiel #3
0
def test_update_metadata(env, git_gecko, git_wpt, pull_request,
                         git_wpt_metadata, mock_mach):
    results_obj = fx_only_failure()

    pr = pull_request([("Test commit", {
        "README": "Example change\n"
    })], "Test PR")

    downstream.new_wpt_pr(git_gecko, git_wpt, pr)
    sync = load.get_pr_sync(git_gecko, git_wpt, pr["number"])

    mock_mach.set_data(
        "wpt-test-paths",
        json.dumps(bugs.fallback_test_ids_to_paths(["/test/test.html"])))

    with patch(
            "sync.notify.bugs.components_for_wpt_paths",
            return_value={"Testing :: web-platform-tests":
                          ["test/test.html"]}):
        with patch("sync.notify.bugs.Mach", return_value=mock_mach(None)):
            with patch("sync.meta.Metadata.github") as mock_github:
                with SyncLock.for_process(sync.process_name) as lock:
                    with sync.as_mut(lock):
                        bug_data = bugs.for_sync(sync, results_obj)
                        bugs.update_metadata(sync, bug_data)

                assert mock_github.create_pull.called
                head = mock_github.method_calls[0].args[-1]

    bugs_filed = bug_data.keys()
    assert len(bugs_filed) == 1
    bug = bugs_filed[0]

    metadata = meta.Metadata(sync.process_name, branch=head)
    links = list(metadata.iterbugs("/test/test.html"))
    assert len(links) == 1
    link = links[0]
    assert link.url == "%s/show_bug.cgi?id=%s" % (env.bz.bz_url, bug)
    assert link.test_id == "/test/test.html"
    assert link.product == "firefox"
    assert link.subtest is None
    assert link.status is None
Beispiel #4
0
def test_already_filed(env):
    results_obj = fx_only_failure()
    sync = Mock()
    sync.lock_key = ("downstream", None)
    sync.notify_bugs = FrozenDict(
        **{"failure :: Testing :: web-platform-tests": "1234"})

    env.config["notify"][
        "components"] = "Foo :: Bar, Testing :: web-platform-tests"
    with patch(
            "sync.notify.bugs.components_for_wpt_paths",
            return_value={"Testing :: web-platform-tests":
                          ["test/test.html"]}):
        with patch("sync.notify.bugs.test_ids_to_paths",
                   return_value={
                       "testing/web-platform/tests/test/test.html":
                       ["/test/test.html"]
                   }):
            bug_data = bugs.for_sync(sync, results_obj)

    assert len(bug_data) == 1
    assert list(bug_data.keys()) == ["1234"]
    assert ("Creating a bug in component Testing :: web-platform-tests"
            not in env.bz.output.getvalue())