Пример #1
0
class TestAddBook(unittest.TestCase):

    def setUp(self):
        self.__conn = Mock(Connection)
        self.__add_book = AddBook(self.__conn)

    def test_adding_book_causes_the_correct_database_calls(self):
        self.__add_book.execute(self.__get_treasure_island())
        self.assertTrue(self.__conn.execute_sql_with_params.called)

    def __get_treasure_island(self):
        b = Book()
        b.id = "1"
        b.title = "Treasure Island"
        b.author = "Robert Louis Stevenson"
        return b
Пример #2
0
 def setUp(self):
     self.__conn = Mock(Connection)
     self.__add_book = AddBook(self.__conn)