コード例 #1
0
    def test_get_logbook_by_name_returns_first_logbook_if_more_with_name(self):
        mock_logbook_3 = Mock()
        mock_logbook_3.name = 'logbook1'
        self.connection.get_logbooks.return_value = (
            self.mock_logbook_1, mock_logbook_3
        )

        ret = get_logbook_by_name('logbook1', self.connection)

        self.assertEqual(ret, self.mock_logbook_1)
コード例 #2
0
 def test_get_logbook_by_name_raises_stop_iteration_if_no_such_lb(self):
     with self.assertRaises(StopIteration):
         get_logbook_by_name('logbook0', self.connection)
コード例 #3
0
    def test_get_logbook_by_name_returns_logbook_2_by_name(self):
        ret = get_logbook_by_name('logbook2', self.connection)

        self.assertEqual(ret, self.mock_logbook_2)
コード例 #4
0
    def test_get_logbook_by_name_gets_logbooks_from_connection(self):
        get_logbook_by_name('logbook1', self.connection)

        self.connection.get_logbooks.assert_called_once_with()