##// END OF EJS Templates
tests: fixed some broken tests
milka -
r4563:98909132 default
parent child Browse files
Show More
@@ -608,23 +608,23 b' class TestPullrequestsView(object):'
608 608 pull_request.source_repo, pull_request=pull_request)
609 609 assert status == ChangesetStatus.STATUS_REJECTED
610 610
611 comment_id = response.json.get('comment_id', None)
612 test_text = 'test'
613 response = self.app.post(
614 route_path(
615 'pullrequest_comment_edit',
616 repo_name=target_scm_name,
617 pull_request_id=pull_request_id,
618 comment_id=comment_id,
619 ),
620 extra_environ=xhr_header,
621 params={
622 'csrf_token': csrf_token,
623 'text': test_text,
624 },
625 status=403,
626 )
627 assert response.status_int == 403
611 for comment_id in response.json.keys():
612 test_text = 'test'
613 response = self.app.post(
614 route_path(
615 'pullrequest_comment_edit',
616 repo_name=target_scm_name,
617 pull_request_id=pull_request_id,
618 comment_id=comment_id,
619 ),
620 extra_environ=xhr_header,
621 params={
622 'csrf_token': csrf_token,
623 'text': test_text,
624 },
625 status=403,
626 )
627 assert response.status_int == 403
628 628
629 629 def test_comment_and_comment_edit(self, pr_util, csrf_token, xhr_header):
630 630 pull_request = pr_util.create_pull_request()
@@ -644,27 +644,27 b' class TestPullrequestsView(object):'
644 644 )
645 645 assert response.json
646 646
647 comment_id = response.json.get('comment_id', None)
648 assert comment_id
649 test_text = 'test'
650 self.app.post(
651 route_path(
652 'pullrequest_comment_edit',
653 repo_name=target_scm_name,
654 pull_request_id=pull_request.pull_request_id,
655 comment_id=comment_id,
656 ),
657 extra_environ=xhr_header,
658 params={
659 'csrf_token': csrf_token,
660 'text': test_text,
661 'version': '0',
662 },
647 for comment_id in response.json.keys():
648 assert comment_id
649 test_text = 'test'
650 self.app.post(
651 route_path(
652 'pullrequest_comment_edit',
653 repo_name=target_scm_name,
654 pull_request_id=pull_request.pull_request_id,
655 comment_id=comment_id,
656 ),
657 extra_environ=xhr_header,
658 params={
659 'csrf_token': csrf_token,
660 'text': test_text,
661 'version': '0',
662 },
663 663
664 )
665 text_form_db = ChangesetComment.query().filter(
666 ChangesetComment.comment_id == comment_id).first().text
667 assert test_text == text_form_db
664 )
665 text_form_db = ChangesetComment.query().filter(
666 ChangesetComment.comment_id == comment_id).first().text
667 assert test_text == text_form_db
668 668
669 669 def test_comment_and_comment_edit(self, pr_util, csrf_token, xhr_header):
670 670 pull_request = pr_util.create_pull_request()
@@ -684,26 +684,25 b' class TestPullrequestsView(object):'
684 684 )
685 685 assert response.json
686 686
687 comment_id = response.json.get('comment_id', None)
688 assert comment_id
689 test_text = 'init'
690 response = self.app.post(
691 route_path(
692 'pullrequest_comment_edit',
693 repo_name=target_scm_name,
694 pull_request_id=pull_request.pull_request_id,
695 comment_id=comment_id,
696 ),
697 extra_environ=xhr_header,
698 params={
699 'csrf_token': csrf_token,
700 'text': test_text,
701 'version': '0',
702 },
703 status=404,
687 for comment_id in response.json.keys():
688 test_text = 'init'
689 response = self.app.post(
690 route_path(
691 'pullrequest_comment_edit',
692 repo_name=target_scm_name,
693 pull_request_id=pull_request.pull_request_id,
694 comment_id=comment_id,
695 ),
696 extra_environ=xhr_header,
697 params={
698 'csrf_token': csrf_token,
699 'text': test_text,
700 'version': '0',
701 },
702 status=404,
704 703
705 )
706 assert response.status_int == 404
704 )
705 assert response.status_int == 404
707 706
708 707 def test_comment_and_try_edit_already_edited(self, pr_util, csrf_token, xhr_header):
709 708 pull_request = pr_util.create_pull_request()
@@ -722,48 +721,46 b' class TestPullrequestsView(object):'
722 721 extra_environ=xhr_header,
723 722 )
724 723 assert response.json
725 comment_id = response.json.get('comment_id', None)
726 assert comment_id
727
728 test_text = 'test'
729 self.app.post(
730 route_path(
731 'pullrequest_comment_edit',
732 repo_name=target_scm_name,
733 pull_request_id=pull_request.pull_request_id,
734 comment_id=comment_id,
735 ),
736 extra_environ=xhr_header,
737 params={
738 'csrf_token': csrf_token,
739 'text': test_text,
740 'version': '0',
741 },
724 for comment_id in response.json.keys():
725 test_text = 'test'
726 self.app.post(
727 route_path(
728 'pullrequest_comment_edit',
729 repo_name=target_scm_name,
730 pull_request_id=pull_request.pull_request_id,
731 comment_id=comment_id,
732 ),
733 extra_environ=xhr_header,
734 params={
735 'csrf_token': csrf_token,
736 'text': test_text,
737 'version': '0',
738 },
742 739
743 )
744 test_text_v2 = 'test_v2'
745 response = self.app.post(
746 route_path(
747 'pullrequest_comment_edit',
748 repo_name=target_scm_name,
749 pull_request_id=pull_request.pull_request_id,
750 comment_id=comment_id,
751 ),
752 extra_environ=xhr_header,
753 params={
754 'csrf_token': csrf_token,
755 'text': test_text_v2,
756 'version': '0',
757 },
758 status=409,
759 )
760 assert response.status_int == 409
740 )
741 test_text_v2 = 'test_v2'
742 response = self.app.post(
743 route_path(
744 'pullrequest_comment_edit',
745 repo_name=target_scm_name,
746 pull_request_id=pull_request.pull_request_id,
747 comment_id=comment_id,
748 ),
749 extra_environ=xhr_header,
750 params={
751 'csrf_token': csrf_token,
752 'text': test_text_v2,
753 'version': '0',
754 },
755 status=409,
756 )
757 assert response.status_int == 409
761 758
762 text_form_db = ChangesetComment.query().filter(
763 ChangesetComment.comment_id == comment_id).first().text
759 text_form_db = ChangesetComment.query().filter(
760 ChangesetComment.comment_id == comment_id).first().text
764 761
765 assert test_text == text_form_db
766 assert test_text_v2 != text_form_db
762 assert test_text == text_form_db
763 assert test_text_v2 != text_form_db
767 764
768 765 def test_comment_and_comment_edit_permissions_forbidden(
769 766 self, autologin_regular_user, user_regular, user_admin, pr_util,
General Comments 0
You need to be logged in to leave comments. Login now