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())
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( )
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())