Esempio n. 1
0
 def test_delete(self):
     card_repository.create(self.card1)
     cards = card_repository.find_all()
     self.assertEqual(len(cards), 1)
     self.assertEqual(cards[0][1], "Teemu Kerppu")
     
     card_repository.delete(self.card1.get_id())
     cards = card_repository.find_all()
     self.assertEqual(len(cards), 0)
Esempio n. 2
0
 def test_delete_all(self):
     card_repository.create(self.card1)
     card_repository.create(self.card2)
     card_repository.create(self.card3)
     cards = card_repository.find_all()
     self.assertEqual(len(cards), 3)
     
     card_repository.delete_all()
     cards = card_repository.find_all()
     self.assertEqual(len(cards), 0)
Esempio n. 3
0
    def test_find_all(self):
        card_repository.create(self.card1)
        card_repository.create(self.card2)
        cards = card_repository.find_all()

        self.assertEqual(len(cards), 2)
        self.assertEqual(cards[0][1], self.card1.get_name())
        self.assertEqual(cards[1][1], self.card2.get_name())
Esempio n. 4
0
    def test_save_update(self):
        card_repository.create(self.card1)
        self.card1.set_name("Korppu")
        card_repository.save(self.card1)
        cards = card_repository.find_all()

        self.assertEqual(len(cards), 1)
        self.assertEqual(cards[0][1], "Korppu")
Esempio n. 5
0
    def test_save_create(self):
        card_repository.save(self.card1)
        cards = card_repository.find_all()

        self.assertEqual(len(cards), 1)
        self.assertEqual(cards[0][1], self.card1.get_name())