def test5AddUsedCard(self): game = GameModel.getGameById(1, self.session) card = CardModel.findCardById(self.session, 2) game.addUsedCard(card) self.session.flush() self.session.commit() self.assertTrue(card in game.usedCards) unusedCards = game.getUnusedCards() self.assertEqual(len(unusedCards), 49)
def testSaveCard(self): delete_db(engine) AppModelBase.metadata.create_all(engine) forbidden = "{'word1', 'word2', 'word3', 'word4'}" card = CardModel(buzzword="unit test", forbidden_words=forbidden, source="Book", source_page="345", skipped_count=0, won_count=0, lost_count=0, is_phrase=IS_PHRASE) self.session.add(card) self.session.commit() card = CardModel.findCardById(self.session, 1) self.assertEqual(card.buzzword, "unit test")
def testRemoveForbiddenWords(self): card = CardModel.findCardById(self.session, 1) card.removeForbiddenWords() self.assertEqual(card.forbiddenWords, "")