def test_deb_build_successful_other_failed(): """ Tests whether a debian was set to successful correctly with multiple builds and the other build has failed """ deb_build = Build(id=1337, buildtype="deb") deb_build.parent = Build(buildtype="source") deb_build.parent.parent = Build(buildtype="build") other_build = Build(buildtype="source") other_build.buildstate = "build_failed" deb_build.parent.children = [deb_build, other_build] deb_build.log_state = MagicMock() deb_build.parent.log_state = MagicMock() deb_build.parent.parent.log_state = MagicMock() with patch("molior.molior.buildlogger.write_log"), \ patch("molior.molior.buildlogger.write_log_title"): loop = asyncio.get_event_loop() loop.run_until_complete(deb_build.set_successful()) assert deb_build.buildstate == "successful" assert deb_build.parent.parent.buildstate != "successful"
def test_deb_build_successful_only_build(): """ Tests whether a debian was set to successful correctly """ deb_build = Build(id=1337, buildtype="deb") deb_build.parent = Build(buildtype="source") deb_build.parent.parent = Build(buildtype="build") deb_build.parent.children = [deb_build] logmock(deb_build) loop = asyncio.get_event_loop() loop.run_until_complete(deb_build.set_successful()) assert deb_build.buildstate == "successful" assert deb_build.parent.parent.buildstate == "successful"
def test_deb_build_successful_other_failed(): """ Tests whether a debian was set to successful correctly with multiple builds and the other build has failed """ deb_build = Build(id=1337, buildtype="deb") deb_build.parent = Build(buildtype="source") deb_build.parent.parent = Build(buildtype="build") other_build = Build(buildtype="source") other_build.buildstate = "build_failed" deb_build.parent.children = [deb_build, other_build] logmock(deb_build) loop = asyncio.get_event_loop() loop.run_until_complete(deb_build.set_successful()) assert deb_build.buildstate == "successful" assert deb_build.parent.parent.buildstate != "successful"