Example #1
0
    def test_find_all(self):
        user_repository.create(self.user1)
        user_repository.create(self.user2)
        users = user_repository.find_all()

        self.assertEqual(len(users), 2)
        self.assertEqual(users[0][0], self.user1.get_username())
        self.assertEqual(users[1][0], self.user2.get_username())
Example #2
0
    def test_find_all(self):
        user_repository.create(self.user_kalle)
        user_repository.create(self.user_matti)
        users = user_repository.find_all()

        self.assertEqual(len(users), 2)
        self.assertEqual(users[0].username, self.user_kalle.username)
        self.assertEqual(users[1].username, self.user_matti.username)
Example #3
0
    def test_delete(self):
        user_repository.create(self.user1)
        users = user_repository.find_all()
        self.assertEqual(len(users), 1)
        self.assertEqual(users[0][0], "matti")

        user_repository.delete(self.user1.get_username())
        users = user_repository.find_all()
        self.assertEqual(len(users), 0)
    def test_delete_all(self):
        user_repository.create(self.user_matti)
        user_repository.create(self.user_kalle)
        users = user_repository.find_all()

        self.assertEqual(len(users), 2)

        user_repository.delete_all()
        users = user_repository.find_all()

        self.assertEqual(len(users), 0)
    def test_find_by_username(self):
        kalle = user_repository.create(self.user_kalle)
        matti = user_repository.create(self.user_matti)

        todo_repository.create(Todo(content='testing a', user=kalle))
        todo_repository.create(Todo(content='testing b', user=matti))

        kalle_todos = todo_repository.find_by_username(
            self.user_kalle.username)

        self.assertEqual(len(kalle_todos), 1)
        self.assertEqual(kalle_todos[0].content, 'testing a')

        matti_todos = todo_repository.find_by_username(
            self.user_matti.username)

        self.assertEqual(len(matti_todos), 1)
        self.assertEqual(matti_todos[0].content, 'testing b')
Example #6
0
    def test_find_by_username(self):
        user_repository.create(self.user1)
        user_repository.create(self.user2)
        user_repository.create(self.user3)
        users = user_repository.find_by_username("kaija")

        self.assertEqual(len(users), 1)
        self.assertEqual(users[0][0], self.user3.get_username())
Example #7
0
    def test_delete_all(self):
        user_repository.create(self.user1)
        user_repository.create(self.user2)
        user_repository.create(self.user3)
        users = user_repository.find_all()
        self.assertEqual(len(users), 3)

        user_repository.delete_all()
        users = user_repository.find_all()
        self.assertEqual(len(users), 0)
Example #8
0
    def test_find_by_username(self):
        user_repository.create(self.user_kalle)

        user = user_repository.find_by_username(self.user_kalle.username)

        self.assertEqual(user.username, self.user_kalle.username)
 def test_find_all(self):
     user_repository.create(self.user_kalevi)
     user_repository.create(self.user_marja)
     users = user_repository.find_all()
     self.assertEqual(len(users), 2)
     self.assertEqual(users[1].username, self.user_marja.username)
 def test_create(self):
     user_repository.create(self.user_kalevi)
     users = user_repository.find_all()
     self.assertEqual(len(users), 1)
     self.assertEqual(users[0].username, self.user_kalevi.username)
Example #11
0
 def __init__(self):
     user_repository.delete_all()
     self.user_test = User('Test', 'test123')
     user_repository.create(self.user_test)
Example #12
0
	def test_create(self):
		user_repository.create(self.user_timo)
		users = user_repository.find_all()

		self.assertEqual(len(users), 1)