def test_review(self, gerrit_api): """Test that a review can be posted by the review API.""" change_id = self._get_test_change(gerrit_api)["id"] review = GerritReview() review.set_message("Review from live test") review.add_labels({"Code-Review": 1}) gerrit_api.review(change_id, "current", review)
def review(self, label=None, vote=1, message=''): print("Posting {} review for change: {}".format( " {}: {}".format(label, vote) if label else '', self)) auth = HTTPDigestAuthFromNetrc(url=GERRIT_URL) rest = GerritRestAPI(url=GERRIT_URL, auth=auth, verify=GERRIT_VERIFY) rev = GerritReview() rev.set_message(message) if label: rev.add_labels({label: vote}) rest.review(self.id, self.patchset, rev)
def review(self, label=None, vote=1, message=''): print_err("Posting {} review for change: {}".format( " {}: {}".format(label, vote) if label else '', self)) auth = HTTPDigestAuthFromNetrc(url=GERRIT_URL) rest = GerritRestAPI(url=GERRIT_URL, auth=auth, verify=GERRIT_VERIFY) rev = GerritReview() rev.set_message(message) if label: rev.add_labels({label: vote}) rest.review(self.id, self.patchset, rev)
def test_review(self, gerrit_api): """Test that a review can be posted by the review API.""" change_id = self._get_test_change(gerrit_api)["id"] review = GerritReview() review.set_message("Review from live test") review.add_labels({"Code-Review": 1}) review.set_tag("a_test_tag") result = gerrit_api.review(change_id, "current", review) assert "labels" in result assert "Code-Review" in result["labels"] assert result["labels"]["Code-Review"] == 1