def test_find_cards_from_cube_that_contains(self): card_repository.create(self.card1) card_repository.create(self.card2) card_repository.create(self.card3) card_repository.create(self.card4) cards = card_repository.find_cards_from_cube_that_contains("id1", "", "Creature", "", ["name", "ASC"]) self.assertEqual(len(cards), 2) self.assertEqual(cards[0][1], self.card2.get_name()) self.assertEqual(cards[1][1], self.card4.get_name())
def test_create_csv_file(self): card_repository.create(self.card1) card_repository.create(self.card2) card_repository.create(self.card3) card_repository.create(self.card4) cursor = card_repository.create_csv_file("id1") cards = cursor.fetchall() self.assertEqual(len(cards), 3) self.assertEqual(cards[0][1], self.card1.get_name()) self.assertEqual(cards[1][1], self.card2.get_name()) self.assertEqual(cards[2][1], self.card4.get_name())
def test_find_by_name_from_cube(self): card_repository.create(self.card1) card_repository.create(self.card2) card_repository.create(self.card3) cards = card_repository.find_by_name_from_cube("id1", "kana") self.assertEqual(len(cards), 1) self.assertEqual(cards[0][1], self.card2.get_name())
def test_find_by_cube(self): card_repository.create(self.card1) card_repository.create(self.card2) card_repository.create(self.card3) cards = card_repository.find_by_cube("id1") self.assertEqual(len(cards), 2) self.assertEqual(cards[0][1], self.card1.get_name()) self.assertEqual(cards[1][1], self.card2.get_name())
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)
def test_create(self): card_repository.create(self.card1) cards = card_repository.find_all() self.assertEqual(len(cards), 1) self.assertEqual(cards[0][1], self.card1.get_name())