示例#1
0
class UserTest(TestCase):
    def setUp(self):

        self.pop = Populator()
        self.pop.run()

    def tearDown(self):

        self.pop.clear()

    def test_save(self):
        self.users = [User(), User(), User()]
        for index, user in enumerate(self.users):
            user.firstName = "User_" + str(index)
            user.lastName = "User_" + str(index) + "_lastName"
            user.userName = "******" + str(index)
            user.passHash = user.userName

        for user in self.users:
            self.assertIsNone(user.id,
                              "The user id for a new user should be None")
            user.save()
            self.assertIsNotNone(
                user.id, "After a save the user id should have a generated id")

        for user in self.users:
            if user.id is not None:
                user.delete()
示例#2
0
class UserTest(TestCase):

    def setUp(self):

        self.pop = Populator()
        self.pop.run()

    def tearDown(self):

        self.pop.clear()

    def test_save(self):
        self.users = [User(), User(), User()]
        for index, user in enumerate(self.users):
            user.firstName = "User_"+str(index)
            user.lastName = "User_"+str(index)+"_lastName"
            user.userName = "******"+str(index)
            user.passHash = user.userName

        for user in self.users:
            self.assertIsNone(user.id, "The user id for a new user should be None")
            user.save()
            self.assertIsNotNone(user.id, "After a save the user id should have a generated id")

        for user in self.users:
            if user.id is not None:
                user.delete()
示例#3
0
class MessageTest(TestCase):
    def setUp(self):
        self.pop = Populator()
        self.pop.run()

        self.message = Message()
        self.users = User.objects

    def tearDown(self):
        if self.message.id is not None:
            self.message.delete()
        self.pop.clear()

    def test_save(self):
        self.message.subject = "First message"
        self.message.text = "This is the first message ever in the system"
        self.message.receiver = self.users[1]
        self.message.sender = self.users[0]
        self.assertIsNone(self.message.id)
        self.message.save()
        self.assertIsNotNone(self.message.id)
示例#4
0
class MessageTest(TestCase):

    def setUp(self):
        self.pop = Populator()
        self.pop.run()

        self.message = Message()
        self.users = User.objects

    def tearDown(self):
        if self.message.id is not None:
            self.message.delete()
        self.pop.clear()

    def test_save(self):
        self.message.subject = "First message"
        self.message.text = "This is the first message ever in the system"
        self.message.receiver = self.users[1]
        self.message.sender = self.users[0]
        self.assertIsNone(self.message.id)
        self.message.save()
        self.assertIsNotNone(self.message.id)
示例#5
0
    def setUp(self):
        self.pop = Populator()
        self.pop.run()

        self.message = Message()
        self.users = User.objects
示例#6
0
    def setUp(self):
        self.pop = Populator()
        self.pop.run()

        self.message = Message()
        self.users = User.objects
示例#7
0
    def setUp(self):

        self.pop = Populator()
        self.pop.run()
示例#8
0
    def setUp(self):

        self.pop = Populator()
        self.pop.run()