def testSaveIfChanged(self):
        new_member = member_util.SaveMember(random_util.Member())
        new_member.username = '******'
        new_member.email = '*****@*****.**'
        member_util.SaveIfChanged(new_member)

        [member] = freesidemodels.Member.all().fetch(1)
        self.assertEquals(member.username, new_member.username)
        self.assertEquals(member.email, new_member.email)
    def SeedPeople(self):
        for _ in range(10):
            person = random_util.Person()
            person.put()
            self.people.append(person)

            member = random_util.Member()
            member.put()
            self.members.append(member)
    def testSaveIfChangedNotChanged(self):
        member = member_util.SaveMember(random_util.Member())

        # TODO(dknowles): Use mox instead
        called = False
        orig_save_member = member_util.SaveMember

        def MockSaveMember(member):
            called = True

        member_util.SaveMember = MockSaveMember

        member_util.SaveIfChanged(member)
        member_util.SaveMember = orig_save_member
        self.failIf(called)
示例#4
0
 def testRandomMember(self):
     # make sure it doesn't asplode
     member = random_util.Member(active=False, admin=True)
     self.assertFalse(member.active)
     self.assertTrue(member.admin)
     self.assertFalse(member.starving)
 def DoSeed(count, member_list, active):
     for _ in xrange(0, count):
         member_list.append(
             member_util.SaveMember(random_util.Member(active=active)))
 def testSave(self):
     member = member_util.SaveMember(random_util.Member())
     self.assertEquals(member.key(), freesidemodels.Member.all()[0].key())