예제 #1
0
    def test_list_all_reviewers(self):
        ur = userrights.UserRights(None)

        self.assertEquals(len(ur.list_all_reviewers()), 0)

        ur.add_permission("admin", userrightsnames.CONF_ADMINISTRATOR)
        self.assertEquals(len(ur.list_all_reviewers()), 0)

        ur.add_permission("review1", userrightsnames.ROUND1_REVIEWER)
        self.assertEquals(len(ur.list_all_reviewers()), 1)
        self.assertEquals(ur.list_all_reviewers(), ["review1"])

        ur.add_permission("review2", userrightsnames.ROUND2_REVIEWER)
        self.assertEquals(len(ur.list_all_reviewers()), 2)
        self.assertEquals(ur.list_all_reviewers(), ["review1", "review2"])

        ur.add_permission("review3", userrightsnames.ROUND1_DECISION)
        self.assertEquals(len(ur.list_all_reviewers()), 3)
        self.assertEquals(ur.list_all_reviewers(), ["review1", "review2", "review3"])

        ur.add_permission("review4", userrightsnames.ROUND2_DECISION)
        self.assertEquals(len(ur.list_all_reviewers()), 4)
        self.assertEquals(ur.list_all_reviewers(), ["review1", "review2", "review3", "review4"])

        ur.add_permission("review1", userrightsnames.ROUND1_FULL_VIEW)
        self.assertEquals(len(ur.list_all_reviewers()), 4)
        self.assertEquals(ur.list_all_reviewers(), ["review1", "review2", "review3", "review4"])

        ur.add_permission("review2", userrightsnames.ROUND2_FULL_VIEW)
        self.assertEquals(len(ur.list_all_reviewers()), 4)
        self.assertEquals(ur.list_all_reviewers(), ["review1", "review2", "review3", "review4"])
예제 #2
0
 def user_rights(self):
     if self.key is None:
         return None
     elif self.is_dummy_conf():
         return openrights.OpenRights(self.key)
     else:
         return userrights.UserRights(self.key)
예제 #3
0
    def test_track_assignments(self):
        ur = userrights.UserRights(None)
        self.assertEquals(ur.track_assignments("harry"), [])

        ur.add_track_reviewer("harry", "track1")
        self.assertEquals(ur.track_assignments("harry"), ["track1"])

        ur.add_track_reviewer("harry", "track2")
        self.assertEquals(ur.track_assignments("harry"), ["track1", "track2"])
예제 #4
0
    def test_remove_all_review_rights(self):
        ur = userrights.UserRights(None)

        self.assertFalse(ur.is_track_reviewer("harry", "technology track"))

        ur.add_track_reviewer("harry", "technology track")
        ur.add_track_reviewer("harry", "business")

        ur.remove_all_review_rights("harry")
        self.assertFalse(ur.is_track_reviewer("harry", "technology track"))
        self.assertFalse(ur.is_track_reviewer("harry", "business"))
예제 #5
0
    def test_add_drop_track_reviewers(self):
        ur = userrights.UserRights(None)

        self.assertFalse(ur.is_track_reviewer("harry", "technology track"))
        self.assertFalse(ur.is_track_reviewer("barry", "technology track"))

        ur.add_track_reviewer("harry", "technology track")
        self.assertTrue(ur.is_track_reviewer("harry", "technology track"))
        self.assertFalse(ur.is_track_reviewer("barry", "technology track"))

        ur.add_track_reviewer("barry", "technology track")
        self.assertTrue(ur.is_track_reviewer("harry", "technology track"))
        self.assertTrue(ur.is_track_reviewer("barry", "technology track"))

        ur.drop_track_reviewer("harry", "technology track")
        self.assertFalse(ur.is_track_reviewer("harry", "technology track"))
        self.assertTrue(ur.is_track_reviewer("barry", "technology track"))
예제 #6
0
    def test_drop_track(self):
        ur = userrights.UserRights(None)

        ur.add_track_reviewer("harry", "technology track")
        ur.add_track_reviewer("ron", "technology track")
        ur.add_track_reviewer("harry", "business")
        ur.add_track_reviewer("ron", "business")
        self.assertTrue(ur.is_track_reviewer("harry", "technology track"))
        self.assertTrue(ur.is_track_reviewer("ron", "technology track"))
        self.assertTrue(ur.is_track_reviewer("harry", "business"))
        self.assertTrue(ur.is_track_reviewer("ron", "business"))

        ur.drop_track("business")

        self.assertTrue(ur.is_track_reviewer("harry", "technology track"))
        self.assertTrue(ur.is_track_reviewer("ron", "technology track"))
        self.assertFalse(ur.is_track_reviewer("harry", "business"))
        self.assertFalse(ur.is_track_reviewer("ron", "business"))
예제 #7
0
    def test_is_reviewer(self):
        ur = userrights.UserRights(None)

        self.assertFalse(ur.is_track_reviewer("harry", "technology track"))
        self.assertFalse(ur.has_track_review_rights("harry"))

        ur.add_track_reviewer("harry", "technology track")
        self.assertTrue(ur.is_track_reviewer("harry", "technology track"))
        self.assertTrue(ur.has_track_review_rights("harry"))
        self.assertTrue(ur.tracks_to_review("harry"), ("technology track"))
        self.assertEquals(len(ur.tracks_to_review("harry")), 1)
        self.assertEquals(ur.tracks_to_review("harry"), ["technology track"])

        self.assertEquals(ur.track_assignments_string("harry"), "technology track")
        ur.add_track_reviewer("harry", "business")
        self.assertEquals(ur.track_assignments_string("harry"), "technology track, business")
        self.assertEquals(len(ur.tracks_to_review("harry")), 2)
        self.assertEquals(ur.tracks_to_review("harry"), ["technology track", "business"])

        ur.drop_track_reviewer("harry", "technology track")
        self.assertFalse(ur.is_track_reviewer("harry", "technology track"))
        self.assertTrue(ur.has_track_review_rights("harry"))
        self.assertEquals(len(ur.tracks_to_review("harry")), 1)
        self.assertEquals(ur.tracks_to_review("harry"), ["business"])
예제 #8
0
    def test_delete_conference(self):
        c = conference.Conference()
        c.name = "TestConf"
        c.put()

        ur = userrights.UserRights(c.key)
        ur.add_track_reviewer("harry", "technology track")
        self.assertEquals(
            1, self.count_db_entries(userrights.RightsRecord, c.key))

        track1 = confoptions.make_conference_track(c.key, "New Track")
        track2 = confoptions.make_conference_track(c.key, "Another track")
        self.assertEquals(
            2, self.count_db_entries(confoptions.TrackOption, c.key))
        duration1 = confoptions.make_conference_option(
            confoptions.DurationOption, c.key, "30 minutes")
        self.assertEquals(
            1, self.count_db_entries(confoptions.DurationOption, c.key))
        confoptions.make_conference_option(confoptions.TalkFormatOption, c.key,
                                           "Lecture")
        self.assertEquals(
            1, self.count_db_entries(confoptions.TalkFormatOption, c.key))
        confoptions.make_conference_option(confoptions.ExpenseOptions, c.key,
                                           "Local")
        self.assertEquals(
            1, self.count_db_entries(confoptions.ExpenseOptions, c.key))

        review_config = confreviewconfig.get_conference_review_factory(c.key)
        self.assertIsNotNone(review_config)
        self.assertEquals(
            1,
            self.count_db_entries(confreviewconfig.ConferenceReviewFactory,
                                  c.key))
        self.assertEquals(
            0, self.count_db_entries(confreviewconfig.ClassicReview, c.key))
        self.assertEquals(
            1, self.count_db_entries(confreviewconfig.NewScoringReview, c.key))
        self.assertEquals(
            1, self.count_db_entries(confreviewconfig.RankReview, c.key))

        s = speaker.make_new_speaker("mail@email")
        s.name = "Arnold Rimmer"
        s.put()

        t = talk.Talk(parent=s.key)
        t.title = "A testing talk"
        t.put()

        sub_key = submissionrecord.make_submission(t.key, c.key, "track",
                                                   "format")
        self.assertEquals(
            1, self.count_db_entries(submissionrecord.SubmissionRecord, c.key))
        vote = voterecord.cast_new_vote(sub_key, "Reviewer1", 2, "No comment",
                                        1)
        self.assertEquals(1, self.count_db_entries(voterecord.VoteRecord,
                                                   c.key))

        rev = reviewer.make_new_reviewer(c.key, "rimmer@email")
        self.assertEquals(1, self.count_db_entries(reviewer.Reviewer, c.key))
        rev.assign_submission("track", [sub_key], review_round=1)
        self.assertEquals(
            1, self.count_db_entries(reviewer.ReviewAssignment, c.key))

        confdelete.cascade_delete_conference(c.key)

        self.assertEquals(
            0, self.count_db_entries(userrights.RightsRecord, c.key))
        self.assertEquals(
            0, self.count_db_entries(submissionrecord.SubmissionRecord, c.key))
        self.assertEquals(0, self.count_db_entries(voterecord.VoteRecord,
                                                   c.key))
        self.assertEquals(
            0, self.count_db_entries(confoptions.TrackOption, c.key))
        self.assertEquals(
            0, self.count_db_entries(confoptions.DurationOption, c.key))
        self.assertEquals(
            0, self.count_db_entries(confoptions.TalkFormatOption, c.key))
        self.assertEquals(
            0, self.count_db_entries(confoptions.ExpenseOptions, c.key))
        self.assertEquals(
            0,
            self.count_db_entries(confoptions.AcknowledgementEmailCCAddresses,
                                  c.key))
        self.assertEquals(
            0,
            self.count_db_entries(confoptions.AcknowledgementEmailBCCAddresses,
                                  c.key))
        self.assertEquals(
            0, self.count_db_entries(confoptions.AcceptEmailCCAddress, c.key))

        self.assertEquals(
            0,
            self.count_db_entries(confreviewconfig.ConferenceReviewFactory,
                                  c.key))
        self.assertEquals(
            0, self.count_db_entries(confreviewconfig.ClassicReview, c.key))
        self.assertEquals(
            0, self.count_db_entries(confreviewconfig.NewScoringReview, c.key))
        self.assertEquals(
            0, self.count_db_entries(confreviewconfig.RankReview, c.key))

        self.assertEquals(
            0, self.count_db_entries(dedupvotes.DuplicateVoteReport, c.key))
        self.assertEquals(
            0, self.count_db_entries(reviewer.ReviewAssignment, c.key))
        self.assertEquals(0, self.count_db_entries(reviewer.Reviewer, c.key))