예제 #1
0
    def test_should_get_all(self, mock_user_get_all):
        user = UserModel()
        user.username = "******"
        user.id = 12
        mock_user_get_all.query.all.return_value = [user]

        users = self.class_under_test.get_all()
        self.assertEqual(1, len(users))

        user = users[0]
        self.assertEqual(12, user.id)
        self.assertEqual('Foo', user.username)
예제 #2
0
    def test_save(self, mock_add, mock_commit):
        user = UserModel()
        user.username = "******"
        user.id = 12

        user.save()