Пример #1
0
    def test_submission_scores(self):
        self.create_conference()

        sub_key = submissionrecord.make_submission(self.t.key, self.c.key,
                                                   "track", "format")

        voterecord.cast_new_vote(sub_key, "Fred", -2, "I hate this talk", 1)
        voterecord.cast_new_vote(sub_key, "Jim", 1, "I sort of like this talk",
                                 1)
        voterecord.cast_new_vote(sub_key, "Sheila", 1, "I like this talk", 1)
        submissions = submissionrecord.retrieve_submissions_records(self.c.key)
        self.assertEquals(len(submissions), 1)
        scores = submissions[0].get_scores(1)
        self.assertEquals(scores.total_score, 0)
        self.assertEquals(scores.mean_score, 0)
        self.assertEquals(scores.median_score, 1.0)
        self.assertEquals(scores.votes, 3)

        t2 = talk.Talk()
        t2.title = "Unreviewed"
        t2.put()
        sub_key = submissionrecord.make_submission(t2.key, self.c.key, "track",
                                                   "format")
        scores2 = sub_key.get().get_scores(1)
        self.assertEquals(scores2.total_score, 0)
        self.assertEquals(scores2.mean_score, 0)
        self.assertEquals(scores2.median_score, 0)
        self.assertEquals(scores2.votes, 0)
Пример #2
0
    def test_speakers_who_have_submitted(self):
        c = conference.Conference()
        c.name = "TestConf"
        c.put()

        blank_speaker = speaker.make_new_speaker("rimmer@email")
        blank_speaker.name = "Arnold Rimmer"
        blank_speaker.put()

        t1 = talk.mk_talk(blank_speaker.key, "Talk T1")
        sub_key1 = submissionrecord.make_submission(t1, c.key, "track",
                                                    "format")

        bioed = speaker.make_new_speaker("cat@email")
        bioed.name = "Arnold Rimmer"
        bioed.bio = "The Cat"
        bioed.put()

        t2 = talk.mk_talk(bioed.key, "Cat Talks")
        sub_key2 = submissionrecord.make_submission(t2, c.key, "track",
                                                    "format")

        spk_list = speaker_checks.find_blank_bio_submissions(c.key)
        self.assertEquals(1, len(spk_list))
        self.assertEquals("rimmer@email", spk_list[0].email)
Пример #3
0
    def test_can_close_conference(self):
        c = conference.Conference()
        c.name = "TestConf"
        c.put()

        # No submissions so no outstanding decisions
        self.assertTrue(confstate.can_close_conference(c.key, 1))

        t1 = talk.Talk()
        t1.title = "Talk T1"
        t1.put()
        sub_key1 = submissionrecord.make_submission(t1.key, c.key, "track",
                                                    "format")

        # can't close while submission is undecided
        self.assertFalse(confstate.can_close_conference(c.key, 1))

        sub = sub_key1.get()
        sub.set_review_decision(1, "Accept")
        sub.put()

        self.assertTrue(confstate.can_close_conference(c.key, 1))

        t2 = talk.Talk()
        t2.title = "Talk T2"
        t2.put()
        sub_key2 = submissionrecord.make_submission(t2.key, c.key, "track",
                                                    "format")
        self.assertFalse(confstate.can_close_conference(c.key, 1))
Пример #4
0
    def setup_test_data(self):
        s = speaker.make_new_speaker("rimmer@email")
        s.name = "Arnold Rimmer"
        s.put()

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

        sub_key1 = submissionrecord.make_submission(t1.key,
                                                    self.conference.key,
                                                    "track", "format")
        t2 = talk.Talk(parent=s.key)
        t2.title = "Another testing talk"
        t2.put()

        sub_key2 = submissionrecord.make_submission(t2.key,
                                                    self.conference.key,
                                                    "track", "format")
        s2 = speaker.make_new_speaker("cat@email")
        s2.name = "Cat"
        s2.put()

        t3 = talk.Talk(parent=s2.key)
        t3.title = "Cool for cats"
        t3.put()
        sub_key3 = submissionrecord.make_submission(t3.key,
                                                    self.conference.key,
                                                    "track", "format")

        return sub_key1, sub_key2, sub_key3
Пример #5
0
    def common_data_setup(self):
        self.c = conference.Conference()
        self.c.name = "TestConf"
        self.c.put()

        # Set up the scenario
        t1 = talk.Talk()
        t1.title = "Talk1 - No duplicate votes"
        t1.put()

        subs_key1 = submissionrecord.make_submission(t1.key, self.c.key,
                                                     "track", "format")
        self.assertEquals(
            len(submissionrecord.retrieve_conference_submissions(self.c.key)),
            1)

        t2 = talk.Talk()
        t2.title = "Talk2 - Allan duplicate votes"
        t2.put()

        subs_key2 = submissionrecord.make_submission(t2.key, self.c.key,
                                                     "track", "format")
        self.assertEquals(
            len(submissionrecord.retrieve_conference_submissions(self.c.key)),
            2)

        return [subs_key1, subs_key2]
Пример #6
0
    def test_retrieve_conference_submissions_keys(self):
        self.create_conference()
        self.assertEquals(
            len(
                submissionrecord.retrieve_conference_submissions_keys(
                    self.c.key)), 0)

        t1 = talk.Talk()
        t1.title = "Talk T1"
        t1.put()
        sub_key = submissionrecord.make_submission(t1.key, self.c.key, "track",
                                                   "format")
        self.assertEquals(
            len(
                submissionrecord.retrieve_conference_submissions_keys(
                    self.c.key)), 1)

        subs_list = submissionrecord.retrieve_conference_submissions_keys(
            self.c.key)
        self.assertEquals(sub_key, subs_list[0])

        sub_key2 = submissionrecord.make_submission(t1.key, self.c.key,
                                                    "track2", "format")
        self.assertEquals(
            len(
                submissionrecord.retrieve_conference_submissions_keys(
                    self.c.key)), 2)

        subs_list = submissionrecord.retrieve_conference_submissions_keys(
            self.c.key)
        self.assertListEqual([sub_key, sub_key2], subs_list)
Пример #7
0
    def test_retrieve_conference_submission_keys_by_track_and_round(self):
        self.create_conference()

        sub_key1 = submissionrecord.make_submission(self.t.key, self.c.key, "Track1", "format")
        sub = sub_key1.get()
        sub.last_review_round = 2
        sub.put()

        t2 = talk.Talk()
        t2.title = "Talk 2"
        t2.put()
        sub_key2 = submissionrecord.make_submission(t2.key, self.c.key, "Track1", "format")

        t3 = talk.Talk()
        t3.title = "Talk 3"
        t3.put()
        sub_key2 = submissionrecord.make_submission(t2.key, self.c.key, "Track3", "format")

        subs_round2track1 = submissions_aux.retrieve_conference_submission_keys_by_track_and_round(
                self.c.key, "Track1", 2)
        self.assertEquals(len(subs_round2track1), 1)
        self.assertItemsEqual([sub_key1], subs_round2track1)

        self.assertEquals(len(
            submissions_aux.retrieve_conference_submission_keys_by_track(self.c.key, "Track2")), 0)

        self.assertEquals(len(
            submissions_aux.retrieve_conference_submissions_by_track(self.c.key, "Track1")), 2)
        self.assertEquals(len(
            submissions_aux.retrieve_conference_submissions_by_track(self.c.key, "Track2")), 0)
Пример #8
0
    def test_filter_for_cospeakers(self):
        t = talk.Talk(parent=self.spk1.key)
        t.title = "Talk talk"
        t.put()
        sub_key1 = submissionrecord.make_submission(t.key, self.c.key, "TrackB", "format")

        t2 = talk.Talk(parent=self.spk1.key)
        t2.title = "More talk"
        t2.put()
        sub_key2 = submissionrecord.make_submission(t2.key, self.c.key, "TrackB", "format")

        cospeak = cospeaker.make_cospeaker(sub_key2, "Harry", "*****@*****.**")

        submissions = [ sub_key1, sub_key2 ]

        sub_speakers_map = cospeaker.filter_for_cospeakers(submissions)

        self.assertFalse(sub_speakers_map.has_key(sub_key1))
        self.assertTrue(sub_speakers_map.has_key(sub_key2))
        self.assertEqual(sub_speakers_map[sub_key2][0].name, "Harry")

        cospeak = cospeaker.make_cospeaker(sub_key2, "Ron", "*****@*****.**")
        sub_speakers_map = cospeaker.filter_for_cospeakers(submissions)

        self.assertFalse(sub_speakers_map.has_key(sub_key1))
        self.assertTrue(sub_speakers_map.has_key(sub_key2))
        cospeakers = sub_speakers_map[sub_key2]
        cospeakers.sort(key=lambda speaker: speaker.name)
        self.assertEqual(sub_speakers_map[sub_key2][0].name, "Harry")
        self.assertEqual(sub_speakers_map[sub_key2][1].name, "Ron")
Пример #9
0
    def test_submissions_conference_map(self):
        self.create_conference()

        c2 = conference.Conference()
        c2.name = "Another Conf"
        c2.put()

        self.assertEquals(len(submissionrecord.get_subs_for_talk(self.t.key)),
                          0)
        self.assertEquals(
            len(submissionrecord.get_confences_talk_submitted_to(self.t.key)),
            0)

        sub_key = submissionrecord.make_submission(self.t.key, self.c.key,
                                                   "track", "format")
        self.assertEquals(len(submissionrecord.get_subs_for_talk(self.t.key)),
                          1)

        self.assertEquals(
            len(submissionrecord.submissions_conference_map(self.t.key)), 1)
        self.assertEquals(
            submissionrecord.submissions_conference_map(
                self.t.key)[sub_key.urlsafe()], "TestConf")

        sub_key = submissionrecord.make_submission(self.t.key, c2.key, "track",
                                                   "format")
        self.assertEquals(len(submissionrecord.get_subs_for_talk(self.t.key)),
                          2)

        self.assertEquals(
            len(submissionrecord.submissions_conference_map(self.t.key)), 2)
        self.assertEquals(
            submissionrecord.submissions_conference_map(
                self.t.key)[sub_key.urlsafe()], "Another Conf")
Пример #10
0
    def test_count_all_speakers(self):
        self.assertEqual(cospeaker.count_all_speakers([]).total_number_of_speakers(), 0)

        t = talk.Talk(parent=self.spk1.key)
        t.title = "Talk talk"
        t.put()
        sub_key1 = submissionrecord.make_submission(t.key, self.c.key, "TrackB", "format")

        submissions = [sub_key1]
        self.assertEqual(cospeaker.count_all_speakers(submissions).total_number_of_speakers(), 1)

        t2 = talk.Talk(parent=self.spk1.key)
        t2.title = "More talk"
        t2.put()
        sub_key2 = submissionrecord.make_submission(t2.key, self.c.key, "TrackB", "format")

        submissions = [sub_key1, sub_key2]
        self.assertEqual(cospeaker.count_all_speakers(submissions).total_number_of_speakers(), 1)

        cospeak = cospeaker.make_cospeaker(sub_key2, "Harry", "*****@*****.**")
        self.assertEqual(cospeaker.count_all_speakers(submissions).total_number_of_speakers(), 2)

        cospeak = cospeaker.make_cospeaker(sub_key2, "Ron", "*****@*****.**")
        self.assertEqual(cospeaker.count_all_speakers(submissions).total_number_of_speakers(), 3)

        cospeak = cospeaker.make_cospeaker(sub_key1, "Ron", "*****@*****.**")
        self.assertEqual(cospeaker.count_all_speakers(submissions).total_number_of_speakers(), 3)
Пример #11
0
    def test_decision_summary(self):
        self.create_conference()

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

        submission = submissionrecord.make_submission(t.key, self.c.key,
                                                      "track", "format").get()
        decision_summary = submissionrecord.get_decision_summary(
            self.c.key, "track", 1)

        self.assertEquals(len(decision_summary), 1)
        self.assertEquals(decision_summary["No decision"], 1)

        submission.set_review_decision(1, "Accept")
        submission.put()

        decision_summary = submissionrecord.get_decision_summary(
            self.c.key, "track", 1)
        self.assertEquals(len(decision_summary), 2)

        self.assertEquals(decision_summary["Accept"], 1)
        self.assertEquals(decision_summary["No decision"], 0)

        t2 = talk.Talk()
        t2.title = "A bad test"
        t2.put()

        sub2 = submissionrecord.make_submission(t2.key, self.c.key, "track",
                                                "format").get()
        sub2.set_review_decision(1, "Reject")
        sub2.put()

        decision_summary = submissionrecord.get_decision_summary(
            self.c.key, "track", 1)
        self.assertEquals(len(decision_summary), 3)
        self.assertEquals(decision_summary["Reject"], 1)
        self.assertEquals(decision_summary["No decision"], 0)

        t3 = talk.Talk()
        t3.title = "A good test"
        t3.put()

        sub3 = submissionrecord.make_submission(t3.key, self.c.key, "track",
                                                "format").get()
        sub3.set_review_decision(1, "Accept")
        sub3.put()

        decision_summary = submissionrecord.get_decision_summary(
            self.c.key, "track", 1)
        self.assertEquals(len(decision_summary), 3)
        self.assertEquals(decision_summary["Accept"], 2)
        self.assertEquals(decision_summary["Reject"], 1)
        self.assertEquals(decision_summary["No decision"], 0)

        decision_summary = submissionrecord.get_decision_summary(
            self.c.key, "another track", 1)
        self.assertEquals(len(decision_summary), 1)
Пример #12
0
    def test_get_commented_votes(self):
        c, t = self.data_setup()

        report = reports.commentreport.get_commented_votes(c.key)
        self.assertEquals(report.comments, {})
        self.assertFalse(report.has_comments)
        subs_key = submissionrecord.make_submission(t.key, c.key, "track",
                                                    "format")
        vote1 = voterecord.cast_new_vote(subs_key, "New reviewer", 1, "", 1)
        report = reports.commentreport.get_commented_votes(c.key)
        self.assertEquals(report.comments, {})
        self.assertFalse(report.has_comments)

        vote2 = voterecord.cast_new_vote(subs_key, "Another reviewer", 1,
                                         "Good", 1)
        report = reports.commentreport.get_commented_votes(c.key)
        self.assertTrue(report.has_comments)
        self.assertEquals(report.comments, {subs_key: [vote2.key]})

        vote3 = voterecord.cast_new_vote(subs_key, "3rd reviewer", 1, "Bad",
                                         -1)
        self.assertEquals(
            reports.commentreport.get_commented_votes(c.key).comments,
            {subs_key: [vote2.key, vote3.key]})

        t2 = talk.Talk()
        t2.title = "A testing talk"
        t2.put()
        subs_key2 = submissionrecord.make_submission(t2.key, c.key, "track",
                                                     "format")
        self.assertEquals(
            reports.commentreport.get_commented_votes(c.key).comments,
            {subs_key: [vote2.key, vote3.key]})

        vote4 = voterecord.cast_new_vote(subs_key2, "New reviewer", 1, "", 2)
        self.assertEquals(
            reports.commentreport.get_commented_votes(c.key).comments,
            {subs_key: [vote2.key, vote3.key]})

        subs_key3 = submissionrecord.make_submission(t2.key, c.key, "track",
                                                     "format")
        self.assertEquals(
            reports.commentreport.get_commented_votes(c.key).comments,
            {subs_key: [vote2.key, vote3.key]})

        vote5 = voterecord.cast_new_vote(subs_key3, "New reviewer", 1, "Yes!",
                                         2)
        self.assertEquals(
            reports.commentreport.get_commented_votes(c.key).comments, {
                subs_key: [vote2.key, vote3.key],
                subs_key3: [vote5.key]
            })
Пример #13
0
    def test_count_votes_for_submissions(self):
        c, t = self.data_setup()
        round = 1

        sub_key = submissionrecord.make_submission(t.key, c.key, "track",
                                                   "format")
        self.assertEquals(
            0, voterecord.count_votes_for_submission(sub_key, round))

        t2 = talk.Talk()
        t2.title = "Another talk"
        t2.put()
        sub_key2 = submissionrecord.make_submission(t2.key, c.key, "track",
                                                    "format")
        self.assertEquals(
            0, voterecord.count_votes_for_submission(sub_key2, round))

        self.assertItemsEqual({
            sub_key: 0,
            sub_key2: 0
        }, voterecord.count_votes_for_submissions([sub_key, sub_key2], 1))

        voterecord.cast_new_vote(sub_key, "Reviewer1", 2, "No comment", 1)
        self.assertEquals(
            1, voterecord.count_votes_for_submission(sub_key, round))
        self.assertItemsEqual({
            sub_key: 1,
            sub_key2: 0
        }, voterecord.count_votes_for_submissions([sub_key, sub_key2], 1))
        voterecord.cast_new_vote(sub_key, "Reviewer2", 2, "No comment", 1)
        self.assertItemsEqual({
            sub_key: 2,
            sub_key2: 0
        }, voterecord.count_votes_for_submissions([sub_key, sub_key2], 1))
        voterecord.cast_new_vote(sub_key2, "Reviewer1", 2, "Comments", 1)
        self.assertItemsEqual({
            sub_key: 2,
            sub_key2: 1
        }, voterecord.count_votes_for_submissions([sub_key, sub_key2], 1))

        self.assertItemsEqual({
            sub_key: 0,
            sub_key2: 0
        }, voterecord.count_votes_for_submissions([sub_key, sub_key2], 2))
        voterecord.cast_new_vote(sub_key, "Reviewer1", 2, "No comment", 2)
        self.assertItemsEqual({
            sub_key: 1,
            sub_key2: 0
        }, voterecord.count_votes_for_submissions([sub_key, sub_key2], 2))
Пример #14
0
    def test_speaker_comms_state(self):
        self.create_conference()

        t1 = talk.Talk()
        t1.title = "Talk T1"
        t1.put()
        sub_key = submissionrecord.make_submission(t1.key, self.c.key, "track",
                                                   "format")
        sub = sub_key.get()

        self.assertEquals(sub.communication, "None")
        sub.acknowledge_receipt()
        self.assertEquals(sub.communication, "Receipt acknowledged")
        sub.mark_decline_pending()
        self.assertEquals(sub.communication, "Decline pending")
        sub.mark_declined()
        self.assertEquals(sub.communication, "Decline sent")
        sub.mark_acccept_pending()
        self.assertEquals(sub.communication, "Accept pending")
        sub.mark_acccept()
        self.assertEquals(sub.communication, "Accept sent")
        sub.mark_accept_acknowledged()
        self.assertEquals(sub.communication, "Acceptance acknowledged")
        sub.mark_accept_declined()
        self.assertEquals(sub.communication, "Acceptance declined")
        sub.mark_accept_problem()
        self.assertEquals(sub.communication, "Acceptance problem")

        sub.mark_comms(submissionnotifynames.SUBMISSION_ACCEPTED)
        self.assertEquals(sub.communication, "Accept sent")

        sub.mark_comms(
            submissionnotifynames.SUBMISSION_FAILED_ACCEPT_NOTIFICATON)
        self.assertEquals(sub.communication, "Accept notification failed")
Пример #15
0
    def test_get_submission_by_talk_and_conf(self):
        self.create_conference()

        t1 = talk.Talk()
        t1.title = "Talk T1"
        t1.put()
        sub_key1 = submissionrecord.make_submission(t1.key, self.c.key,
                                                    "track", "format")

        t2 = talk.Talk()
        t2.title = "Unsubmitted"
        t2.put()

        self.assertEquals(
            sub_key1,
            submissionrecord.get_submission_by_talk_and_conf(
                t1.key, "TestConf"))
        self.assertEquals(
            None,
            submissionrecord.get_submission_by_talk_and_conf(
                t2.key, "TestConf"))

        # does not get listed for other conferences
        c2 = conference.Conference()
        c2.name = "OtherConf"
        c2.put()

        self.assertEquals(
            None,
            submissionrecord.get_submission_by_talk_and_conf(
                t1.key, "OtherConf"))
        self.assertEquals(
            None,
            submissionrecord.get_submission_by_talk_and_conf(
                t2.key, "OtherConf"))
Пример #16
0
    def test_get_scores(self):
        self.create_conference()

        t1 = talk.Talk()
        t1.title = "Talk T1"
        t1.put()
        sub_key1 = submissionrecord.make_submission(t1.key, self.c.key,
                                                    "track", "format")
        voterecord.cast_new_vote(sub_key1, "Fred", -2, "I hate this talk", 1)
        voterecord.cast_new_vote(sub_key1, "Jill", -2, "I hate this talk too",
                                 1)

        scores1 = sub_key1.get().get_scores(1)
        self.assertEquals(scores1.mean_score, -2)
        self.assertEquals(scores1.median_score, -2)
        self.assertEquals(scores1.total_score, -4)
        self.assertEquals(scores1.votes, 2)

        scores2 = sub_key1.get().get_scores(2)
        self.assertEquals(scores2.mean_score, 0)
        self.assertEquals(scores2.median_score, 0)
        self.assertEquals(scores2.total_score, 0)
        self.assertEquals(scores2.votes, 0)

        voterecord.cast_new_vote(sub_key1, "Fred", 1, "One", 2)
        voterecord.cast_new_vote(sub_key1, "Jim", 2, "Two", 2)
        voterecord.cast_new_vote(sub_key1, "Shiela", 2, "Two two", 2)

        scores2 = sub_key1.get().get_scores(2)
        self.assertEquals(scores2.total_score, 5)
        self.assertEquals(scores2.mean_score, 1.67)
        self.assertEquals(scores2.median_score, 2)
        self.assertEquals(scores2.votes, 3)
Пример #17
0
    def test_delete_vote_comments(self):
        c, t = self.data_setup()

        report = reports.commentreport.get_commented_votes(c.key)
        subs_key = submissionrecord.make_submission(t.key, c.key, "track",
                                                    "format")
        vote1 = voterecord.cast_new_vote(subs_key, "New reviewer", 1,
                                         "Comment", 1)
        vote2 = voterecord.cast_new_vote(subs_key, "Another reviewer", 1,
                                         "Good", 1)
        vote3 = voterecord.cast_new_vote(subs_key, "3rd reviewer", 1, "Bad",
                                         -1)
        vote4 = voterecord.cast_new_vote(subs_key, "4th", 1, "", 3)

        self.assertEquals("Comment", vote1.comment)
        self.assertEquals("Good", vote2.comment)
        self.assertEquals("Bad", vote3.comment)
        self.assertEquals("", vote4.comment)

        reports.commentreport.delete_vote_comments(
            [vote1.key, vote2.key, vote3.key, vote4.key])
        self.assertEquals("", vote1.comment)
        self.assertEquals("", vote2.comment)
        self.assertEquals("", vote3.comment)
        self.assertEquals("", vote4.comment)

        # check they are in the db correctly
        # Todo: this test always works... even when put removed... need to fix
        votes = voterecord.find_existing_votes(subs_key, 1)
        for v in votes:
            self.assertEquals("", v.comment)
Пример #18
0
    def test_find_existing_vote_by_reviewer(self):
        c, t = self.data_setup()

        subs_key = submissionrecord.make_submission(t.key, c.key, "track",
                                                    "format")
        self.assertEquals(
            len(submission_queries.retrieve_conference_submissions(c.key)), 1)

        existing_vote = voterecord.find_existing_vote_by_reviewer(
            subs_key, "Reviewer", 1)
        self.assertTrue(existing_vote is None)

        vote = voterecord.VoteRecord(parent=subs_key)
        vote.cast_vote("Reviewer", 2, "Vote early, vote often", 1)

        existing_vote = voterecord.find_existing_vote_by_reviewer(
            subs_key, "Reviewer", 1)
        self.assertTrue(existing_vote is not None)

        existing_vote = voterecord.find_existing_vote_by_reviewer(
            subs_key, "Never voted reviewer", 1)
        self.assertTrue(existing_vote is None)

        # test cast_vote wrapper
        vote = voterecord.cast_new_vote(subs_key, "New reviewer", 1, "OK", 1)
        new_vote = voterecord.find_existing_vote_by_reviewer(
            subs_key, "New reviewer", 1)
        self.assertTrue(new_vote is not None)
        self.assertEquals(new_vote.comment, "OK")
Пример #19
0
    def test_answer_retrieval(self):
        c = self.create_conference()
        question_key = confquestion.mk_question(c.key, "Yes or no?").key

        sub_key = submissionrecord.make_submission(None, c.key, "track",
                                                   "format")

        ans = submission_ans.mk_answer(sub_key, question_key,
                                       "The answer is yes")

        found_ans = submission_ans.retrieve_answer(sub_key, question_key)
        self.assertEqual("The answer is yes", found_ans.answer())
        self.assertEqual(question_key, found_ans.question_key)

        question_key2 = confquestion.mk_question(c.key,
                                                 "To be or not to be").key
        found_ans = submission_ans.retrieve_answer(sub_key, question_key2)
        self.assertEquals(None, found_ans)

        found_ans = submission_ans.retrieve_answer_or_dummy(
            sub_key, question_key)
        self.assertEqual("The answer is yes", found_ans.answer())
        self.assertEqual(question_key, found_ans.question_key)

        found_ans = submission_ans.retrieve_answer_or_dummy(
            sub_key, question_key2)
        self.assertNotEquals(None, found_ans)
        self.assertEquals("", found_ans.answer())
        self.assertEquals(question_key2, found_ans.question_key)
Пример #20
0
    def test_retrieve_all_reviews(self):
        c = conference.Conference()
        c.name = "TestConf"
        c.put()

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

        sub_key = submissionrecord.make_submission(t.key, c.key, "track",
                                                   "format")
        self.assertEquals(
            len(submissionrecord.retrieve_conference_submissions(c.key)), 1)

        self.assertEquals(
            len(roundreviews.retrieve_all_reviews(sub_key.get())), 0)

        voterecord.cast_new_vote(sub_key, "Fred", -2, "I hate this talk", 1)
        reviews = roundreviews.retrieve_all_reviews(sub_key.get())
        self.assertEquals(
            len(roundreviews.retrieve_all_reviews(sub_key.get())), 1)
        voterecord.cast_new_vote(sub_key, "Jim", 1, "I sort of like this talk",
                                 1)

        t2 = talk.Talk()
        t2.title = "Another talk"
        t2.put()
        sub_key2 = submissionrecord.make_submission(t2.key, c.key, "track",
                                                    "format")
        voterecord.cast_new_vote(sub_key2, "Barney", 1, "Yo ho ho", 1)

        reviews = roundreviews.retrieve_all_reviews(sub_key.get())
        self.assertEquals(len(reviews), 2)
        self.assertEquals(reviews[0].reviewer, "Fred")
        self.assertEquals(reviews[1].reviewer, "Jim")

        sub_key.get().set_review_decision(1, "Round2")
        sub_key2.get().set_review_decision(1, "Decline")
        confstate.close_round1_and_open_round2(c)

        voterecord.cast_new_vote(sub_key, "Sheila", 1, "Yes please", 2)

        reviews = roundreviews.retrieve_all_reviews(sub_key.get())
        self.assertEquals(len(reviews), 3)
        self.assertEquals(reviews[0].reviewer, "Fred")
        self.assertEquals(reviews[1].reviewer, "Jim")
        self.assertEquals(reviews[2].reviewer, "Sheila")
Пример #21
0
    def test_mass_track_change(self):
        c = conference.Conference()
        c.name = "TestConf"
        c.put()

        ReviewRound = 1

        t1 = talk.Talk()
        t1.title = "Talk T1 - No decsion"
        t1.put()
        sub_key1 = submissionrecord.make_submission(t1.key, c.key, "track 1",
                                                    "format")
        self.assertEqual(sub_key1.get().review_decision(ReviewRound),
                         "No decision")

        t2 = talk.Talk()
        t2.title = "Talk T2 - Accept"
        t2.put()
        sub_key2 = submissionrecord.make_submission(t2.key, c.key, "track 1",
                                                    "format")
        sub_key2.get().set_review_decision(ReviewRound, "Accept")

        t3 = talk.Talk()
        t3.title = "Talk T3 - No decsion"
        t3.put()
        sub_key3 = submissionrecord.make_submission(t1.key, c.key, "track 1",
                                                    "format")
        self.assertEqual(sub_key3.get().review_decision(ReviewRound),
                         "No decision")

        t4 = talk.Talk()
        t4.title = "Talk T4 - Shortlist"
        t4.put()
        sub_key4 = submissionrecord.make_submission(t4.key, c.key, "track 1",
                                                    "format")
        sub_key4.get().set_review_decision(ReviewRound, "Shortlist")

        roundreviews.mass_track_change(c.key, "track 1", ReviewRound,
                                       "No decision", "Decline")
        self.assertEqual(sub_key1.get().review_decision(ReviewRound),
                         "Decline")
        self.assertEqual(sub_key2.get().review_decision(ReviewRound), "Accept")
        self.assertEqual(sub_key3.get().review_decision(ReviewRound),
                         "Decline")
        self.assertEqual(sub_key4.get().review_decision(ReviewRound),
                         "Shortlist")
Пример #22
0
    def test_current_review_assisgments(self):
        sub_key1, sub_key2, sub_key3 = self.setup_test_data()

        reviewer1 = reviewer.make_new_reviewer(self.conference.key,
                                               "rimmer@email")
        self.assertItemsEqual([],
                              reviewer1.retrieve_review_assignments(
                                  "track", review_round=1))
        self.assertItemsEqual(
            [],
            reviewer1.retrieve_review_assignments_for_round(review_round=1))

        reviewer2 = reviewer.make_new_reviewer(self.conference.key,
                                               "cat@email")
        self.assertItemsEqual([],
                              reviewer1.retrieve_review_assignments(
                                  "track", review_round=1))

        reviewer1.assign_submission("track", [sub_key3], review_round=1)
        self.assertItemsEqual([sub_key3],
                              reviewer1.retrieve_review_assignments(
                                  "track", review_round=1))
        self.assertItemsEqual(
            [sub_key3],
            reviewer1.retrieve_review_assignments_for_round(review_round=1))

        reviewer1.assign_submission("track", [sub_key2], review_round=1)
        self.assertItemsEqual([sub_key2, sub_key3],
                              reviewer1.retrieve_review_assignments(
                                  "track", review_round=1))
        self.assertItemsEqual(
            [sub_key2, sub_key3],
            reviewer1.retrieve_review_assignments_for_round(review_round=1))

        reviewer2.assign_submission("track", [sub_key1, sub_key2],
                                    review_round=1)
        self.assertItemsEqual([sub_key2, sub_key1],
                              reviewer2.retrieve_review_assignments(
                                  "track", review_round=1))

        t4 = talk.Talk(parent=None)
        t4.title = "Nobody on another track"
        t4.put()
        sub_key4 = submissionrecord.make_submission(t4.key,
                                                    self.conference.key,
                                                    "another_track", "format")
        reviewer1.assign_submission("another_track", [sub_key4],
                                    review_round=1)
        self.assertItemsEqual([sub_key2, sub_key3],
                              reviewer1.retrieve_review_assignments(
                                  "track", review_round=1))
        self.assertItemsEqual([sub_key4],
                              reviewer1.retrieve_review_assignments(
                                  "another_track", review_round=1))
        self.assertItemsEqual(
            [sub_key2, sub_key3, sub_key4],
            reviewer1.retrieve_review_assignments_for_round(review_round=1))
Пример #23
0
    def test_summary(self):
        c, t = self.data_setup()
        round = 1

        sub_key = submissionrecord.make_submission(t.key, c.key, "track",
                                                   "format")
        self.assertEquals(
            len(submissionrecord.retrieve_conference_submissions(c.key)), 1)

        summary = votesummary.retrieve_vote_summary("Reviewer1", round)
        self.assertEquals(len(summary), 0)

        voterecord.cast_new_vote(sub_key, "Reviewer1", 2, "No comment", 1)
        summary = votesummary.retrieve_vote_summary("Reviewer1", round)

        self.assertEquals(len(summary), 1)
        self.assertTrue(summary.has_key(sub_key.urlsafe()))
        self.assertTrue(summary[sub_key.urlsafe()].score, 2)
        self.assertTrue(summary[sub_key.urlsafe()].shared_comment,
                        "Yes comment")
        self.assertTrue(summary[sub_key.urlsafe()].shared_comment, "")

        t2 = talk.Talk()
        t2.title = "Another talk"
        t2.put()

        sub_key2 = submissionrecord.make_submission(t2.key, c.key, "track",
                                                    "format")
        voterecord.cast_new_vote(sub_key2, "Reviewer1", 2, "Comments", 1)
        summary = votesummary.retrieve_vote_summary("Reviewer1", round)

        self.assertEquals(len(summary), 2)
        self.assertTrue(summary.has_key(sub_key2.urlsafe()))
        self.assertTrue(summary[sub_key2.urlsafe()].score, 1)
        self.assertTrue(summary[sub_key2.urlsafe()].shared_comment, "Comment2")
        self.assertTrue(summary[sub_key2.urlsafe()].shared_comment, "PRIVATE")

        voterecord.cast_new_vote(sub_key2, "Reviewer2", 2, "Comments", 1)
        self.assertEquals(
            len(votesummary.retrieve_vote_summary("Reviewer1", round)), 2)
        self.assertEquals(
            len(votesummary.retrieve_vote_summary("Reviewer2", round)), 1)
        self.assertEquals(
            len(votesummary.retrieve_vote_summary("Reviewer3", round)), 0)
Пример #24
0
    def test_sort_submissions_low__to_high(self):
        self.create_conference()

        t3 = talk.Talk()
        t3.title = "A round talk"
        t3.put()
        sub_key3 = submissionrecord.make_submission(t3.key, self.c.key,
                                                    "track", "format")
        voterecord.cast_new_vote(sub_key3, "Fred", 1, "I like this talk", 1)

        t1 = talk.Talk()
        t1.title = "A testing talk"
        t1.put()
        sub_key1 = submissionrecord.make_submission(t1.key, self.c.key,
                                                    "track", "format")
        voterecord.cast_new_vote(sub_key1, "Fred", -2, "I hate this talk", 1)

        t4 = talk.Talk()
        t4.title = "Another round talk"
        t4.put()
        sub_key4 = submissionrecord.make_submission(t4.key, self.c.key,
                                                    "track", "format")
        voterecord.cast_new_vote(sub_key4, "Fred", 2,
                                 "I really like this talk", 1)

        t2 = talk.Talk()
        t2.title = "Another testing talk"
        t2.put()
        sub_key2 = submissionrecord.make_submission(t2.key, self.c.key,
                                                    "track", "format")
        voterecord.cast_new_vote(sub_key2, "Fred", -1, "I dislike this talk",
                                 1)

        submissions = submissionrecord.retrieve_submissions_records(self.c.key)
        sorted_submissions = submissionrecord.sort_low_to_high(
            submissions, "Fred", 1)

        self.assertEquals(len(sorted_submissions), 4)
        self.assertEquals(sorted_submissions[0].title(), t1.title)
        self.assertEquals(sorted_submissions[1].title(), t2.title)
        self.assertEquals(sorted_submissions[2].title(), t3.title)
        self.assertEquals(sorted_submissions[3].title(), t4.title)
Пример #25
0
    def test_retrieve_conference_submissions_by_track(self):
        self.create_conference()

        submissionrecord.make_submission(self.t.key, self.c.key, "Track1", "format")
        self.assertEquals(len(
            submissions_aux.retrieve_conference_submissions_by_track(self.c.key, "Track1")), 1)
        self.assertEquals(len(
            submissions_aux.retrieve_conference_submissions_by_track(self.c.key, "Track2")), 0)
        self.assertEquals(len(
            submissions_aux.retrieve_conference_submission_keys_by_track(self.c.key, "Track1")), 1)
        self.assertEquals(len(
            submissions_aux.retrieve_conference_submission_keys_by_track(self.c.key, "Track2")), 0)

        t2 = talk.Talk()
        t2.title = "Talk 2"
        t2.put()

        submissionrecord.make_submission(t2.key, self.c.key, "Track1", "format")
        self.assertEquals(len(
            submissions_aux.retrieve_conference_submissions_by_track(self.c.key, "Track1")), 2)
        self.assertEquals(len(
            submissions_aux.retrieve_conference_submissions_by_track(self.c.key, "Track2")), 0)

        t3 = talk.Talk()
        t3.title = "Talk 3 Track 2"
        t3.put()

        sub_key3 = submissionrecord.make_submission(t3.key, self.c.key, "Track2", "format")
        self.assertEquals(len(
            submissions_aux.retrieve_conference_submissions_by_track(self.c.key, "Track1")), 2)
        self.assertEquals(len(
            submissions_aux.retrieve_conference_submissions_by_track(self.c.key, "Track2")), 1)
        self.assertEquals(len(
            submissions_aux.retrieve_conference_submission_keys_by_track(self.c.key, "Track1")), 2)
        self.assertEquals(len(
            submissions_aux.retrieve_conference_submission_keys_by_track(self.c.key, "Track2")), 1)

        sub_key3.get().withdraw()
        self.assertEquals(len(
            submissions_aux.retrieve_conference_submissions_by_track(self.c.key, "Track1")), 2)
        self.assertEquals(len(
            submissions_aux.retrieve_conference_submissions_by_track(self.c.key, "Track2")), 0)
Пример #26
0
    def test_submit_decision(self):
        c = conference.Conference()
        c.name = "TestConf"
        c.put()

        t1 = talk.Talk()
        t1.title = "Talk T1 - Accept"
        t1.put()
        sub_key1 = submissionrecord.make_submission(t1.key, c.key, "track 1",
                                                    "format")

        t2 = talk.Talk()
        t2.title = "Talk T2 - Reject"
        t2.put()
        sub_key2 = submissionrecord.make_submission(t2.key, c.key, "track 1",
                                                    "format")

        decisions_map = {
            sub_key1.urlsafe(): "Accept",
            sub_key2.urlsafe(): "Decline"
        }

        t3 = talk.Talk()
        t3.title = "Talk T3 - No decision, different track"
        t3.put()
        sub_key3 = submissionrecord.make_submission(t3.key, c.key, "track 2",
                                                    "format")

        c.start_round1_reviews()

        roundreviews.submit_decisions(c.key, "track 1", 1, decisions_map)

        self.assertEquals(sub_key1.get().review_decision(1), "Accept")
        self.assertEquals(sub_key2.get().review_decision(1), "Decline")
        self.assertEquals(sub_key3.get().review_decision(1), "No decision")

        decisions_map = {sub_key3.urlsafe(): "Accept"}
        roundreviews.submit_decisions(c.key, "track 2", 1, decisions_map)

        self.assertEquals(sub_key1.get().review_decision(1), "Accept")
        self.assertEquals(sub_key2.get().review_decision(1), "Decline")
        self.assertEquals(sub_key3.get().review_decision(1), "Accept")
Пример #27
0
    def test_track_and_format(self):
        self.create_conference()

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

        subs_key = submissionrecord.make_submission(t.key, self.c.key,
                                                    "Track1", "WithComputers")
        self.assertEquals(subs_key.get().track, "Track1")
        self.assertEquals(subs_key.get().delivery_format, "WithComputers")
Пример #28
0
    def test_schedule_to_excel(self, mock_storage_open, mock_sheet_write,
                               mock_merge):
        sched_key = schedule.get_conference_schedule(self.c.key)
        sched = sched_key.get()

        sched.add_day("Monday")
        sched.add_track("Monday", "Software")
        sched.add_track("Monday", "Hardware")

        sched.add_slot(
            "Monday",
            schedule.Slot(datetime.time(9, 0), datetime.time(9, 30), "Tracks"))
        sched.add_slot(
            "Monday",
            schedule.Slot(datetime.time(10, 0), datetime.time(10, 30),
                          "Plenary"))

        t = talk.mk_talk(None, "Random talk")
        sub = submissionrecord.make_submission(t, self.c.key, "Track1",
                                               "FormatX")
        sched.assign_talk(sub.urlsafe(), "Monday", "Hardware",
                          datetime.time(9, 0))

        self.assertEquals(0, mock_storage_open.call_count)
        url = schedexport.schedule_to_excel(sched)
        self.assertEquals(1, mock_storage_open.call_count)
        self.assertEquals(8, mock_sheet_write.call_count)
        self.assertEquals(1, mock_merge.call_count)

        self.assertEquals(
            "https:///mimas-aotb.appspot.com.storage.googleapis.com/Schedule",
            url[0:63])
        self.assertEquals(".xlsx", url[len(url) - 5:])

        self.assertEquals((0, 2, "Software"),
                          mock_sheet_write.mock_calls[0][1][1:])
        self.assertEquals((0, 3, "Hardware"),
                          mock_sheet_write.mock_calls[1][1][1:])

        self.assertEquals((1, 0, "09:00"),
                          mock_sheet_write.mock_calls[2][1][1:])
        self.assertEquals((1, 1, "09:30"),
                          mock_sheet_write.mock_calls[3][1][1:])
        self.assertEquals((1, 2, "Empty"),
                          mock_sheet_write.mock_calls[4][1][1:])
        self.assertEquals((1, 3, "Random talk"),
                          mock_sheet_write.mock_calls[5][1][1:])

        self.assertEquals((2, 0, "10:00"),
                          mock_sheet_write.mock_calls[6][1][1:])
        self.assertEquals((2, 1, "10:30"),
                          mock_sheet_write.mock_calls[7][1][1:])
        self.assertEquals((2, 2, 2, 3, "Empty"),
                          mock_merge.mock_calls[0][1][1:])
Пример #29
0
    def test_delete_cospeakers(self):
        t = talk.Talk(parent=self.spk1.key)
        t.title = "Talk talk"
        t.put()
        sub_key1 = submissionrecord.make_submission(t.key, self.c.key, "TrackB", "format")
        cospeak = cospeaker.make_cospeaker(sub_key1, "Harry", "*****@*****.**")
        cospeak2 = cospeaker.make_cospeaker(sub_key1, "Ron", "*****@*****.**")
        self.assertEquals(len(cospeaker.get_cospeakers(sub_key1)), 2)

        cospeaker.delete_cospeakers(sub_key1)
        self.assertEquals(len(cospeaker.get_cospeakers(sub_key1)), 0)
Пример #30
0
    def test_listed_cospeaker(self):
        self.assertFalse(cospeaker.is_listed_cospeaker("*****@*****.**"))

        t = talk.Talk(parent=self.spk1.key)
        t.title = "Talk talk"
        t.put()
        sub_key1 = submissionrecord.make_submission(t.key, self.c.key, "TrackB", "format")

        cospeak = cospeaker.make_cospeaker(sub_key1, "Harry", "*****@*****.**")
        self.assertFalse(speaker.speaker_exists("*****@*****.**"))

        self.assertFalse(cospeaker.is_listed_cospeaker("*****@*****.**"))