Ejemplo n.º 1
0
 def test_make_new_speaker(self):
     self.assertFalse(speaker.speaker_exists("mail@email"))
     s = speaker.make_new_speaker("mail@email")
     self.assertFalse(s.is_zero_deleted())
     self.assertEquals(s.name, "")
     self.assertEquals(s.telephone, "")
     self.assertEquals(s.email, "mail@email")
     self.assertFalse(speaker.speaker_exists("mail@email"))
Ejemplo n.º 2
0
    def test_speakers_retrievable(self):
        email = "allan@allan"
        self.assertFalse(speaker.speaker_exists(email))

        s = speaker.make_new_speaker("mail@email")
        s.email = email

        s.put()
        self.assertTrue(speaker.speaker_exists(email))

        retrieved = speaker.retreive_speaker(email)
        self.assertTrue(retrieved.email, email)
Ejemplo n.º 3
0
    def test_retreive_or_make(self):
        s_key = speaker.make_and_store_new_speaker("*****@*****.**")
        self.assertTrue(speaker.speaker_exists("*****@*****.**"))

        s = s_key.get()
        s.name = "Ron Weasley"
        s.put()
        self.assertTrue(speaker.speaker_exists("*****@*****.**"))
        ron = speaker.retrieve_or_make("*****@*****.**")
        self.assertEquals("Ron Weasley", ron.name)

        self.assertFalse(speaker.speaker_exists("*****@*****.**"))
        harry = speaker.retrieve_or_make("*****@*****.**")
        self.assertTrue(speaker.speaker_exists("*****@*****.**"))
        self.assertEquals("", harry.name)
Ejemplo n.º 4
0
    def test_zero_out_speaker(self):
        s = speaker.make_new_speaker("mail@email")
        s.telephone = "+44 123"
        s.address = "Yellow Brick Road"
        s.bio = "Once upon a time"
        s.set_field("Twitter", "@Tweetypy")
        s.set_field(s.FIELD_JOBTITLE, "Superman")
        s.put()
        speakerdir.SpeakerDir().add_speaker(s.key)
        image.store_only_image(s.key, "Just some binary data")
        tags.TagList(s.key).add_tag("Test", "Speaker")

        self.assertTrue(image.image_exists(s.key))
        self.assertFalse(s.is_zero_deleted())

        s.zero_out_speaker()

        self.assertTrue(s.is_zero_deleted())

        self.assertFalse(speaker.speaker_exists("mail@email"))
        self.assertEquals("*****@*****.**", s.email)
        self.assertEquals("", s.telephone)
        self.assertEquals("", s.address)
        self.assertEquals("", s.bio)
        self.assertEquals("", s.field("Twitter"))
        self.assertFalse(speakerdir.SpeakerDir().is_speaker_listed(s.key))
        self.assertEquals([], tags.TagList(s.key).get_all_tags([]))
        self.assertFalse(image.image_exists(s.key))
Ejemplo n.º 5
0
    def test_profile_exists(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")

        self.assertEquals(len(cospeaker.get_cospeakers(sub_key1)), 0)

        cospeak = cospeaker.make_cospeaker(sub_key1, "Harry", "*****@*****.**")
        r = cospeaker.get_cospeakers(sub_key1)
        self.assertEquals(len(r), 1)
        self.assertEquals(r[0], cospeak)

        self.assertFalse(r[0].profile_exists())
        self.assertFalse(speaker.speaker_exists("*****@*****.**"))
        harry = speaker.make_new_speaker("*****@*****.**")
        harry.put()
        self.assertTrue(speaker.speaker_exists("*****@*****.**"))
        self.assertTrue(r[0].profile_exists())
Ejemplo n.º 6
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("*****@*****.**"))
Ejemplo n.º 7
0
    def post_notification(self, sub_key, cospeak_key):
        if speaker.speaker_exists(self.request.get("cospeakeremail")):
            msg = msgtemplate.CoSpeakerBioExistsMsg()
        else:
            msg = msgtemplate.CoSpeakerBioRequestMsg()

        msg.set_cospeaker(cospeak_key)

        conference = sub_key.parent().get()
        msg.set_from_name_and_address(conference.name,
                                      conference.contact_email())
        msg.set_to_address(self.request.get("cospeakeremail"))
        postmail.Postman().post_addressed_one(conference, msg, sub_key)
Ejemplo n.º 8
0
    def test_ctor(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", "*****@*****.**")
        self.assertFalse(speaker.speaker_exists("*****@*****.**"))
        self.assertEquals(cospeak.name, "Harry")
        self.assertFalse(speaker.speaker_exists("*****@*****.**"))
        self.assertEquals(cospeak.email, "*****@*****.**")
        self.assertFalse(speaker.speaker_exists("*****@*****.**"))
        self.assertEquals(cospeak.profile().bio, "No bio supplied")
        self.assertFalse(speaker.speaker_exists("*****@*****.**"))
        self.assertFalse(cospeak.profile_exists())

        spk2 = speaker.make_new_speaker("*****@*****.**")
        spk2.name="Harry"
        spk2.bio="The child who lived"
        spk2.put()

        # add a speaker profile on that email address
        self.assertTrue(cospeak.profile_exists())
        self.assertEquals(cospeak.profile().bio, "The child who lived")
Ejemplo n.º 9
0
def all_user_talks_by_email(username):
    if not speaker.speaker_exists(username):
        return {}

    who = speaker.retreive_speaker(username)
    return Talk.query(ancestor=who.key).fetch()
Ejemplo n.º 10
0
 def test_speaker_exists(self):
     self.assertFalse(speaker.speaker_exists("shaggy"))