def test_build_failed(mock_koji_cs): """Test the Koji handler when it recieves a new build failed message.""" mock_koji_session = mock.Mock() mock_koji_session.getBuild.return_value = utils.mock_getBuild(koji.BUILD_STATES['FAILED']) mock_koji_cs.return_value = mock_koji_session utils.mock_kojiBuild(koji.BUILD_STATES['BUILDING']) with open(path.join(message_dir, 'koji', 'build_failed.json'), 'r') as f: msg = json.load(f) assert KojiHandler.can_handle(msg) is True handler = KojiHandler(config) handler.handle(msg) build = KojiBuild.nodes.get_or_none(id_='710916') assert build is not None assert build.state == 3
def test_build_building(mock_koji_cs): """Test the Koji handler when it recieves a new build building message.""" mock_koji_session = mock.Mock() mock_koji_session.getBuild.return_value = \ utils.mock_getBuild(koji.BUILD_STATES['BUILDING']) mock_koji_cs.return_value = mock_koji_session with open(path.join(message_dir, 'koji', 'build_building.json'), 'r') as f: msg = json.load(f) assert KojiHandler.can_handle(msg) is True handler = KojiHandler(config) handler.handle(msg) build = KojiBuild.nodes.get_or_none(id_='710916') assert build is not None assert build.state == 0 commit = DistGitCommit.nodes.get_or_none(hash_='09d40c9bdfd34c5130f8f02e49e059efd33bddf7') build.commit.is_connected(commit)