Beispiel #1
0
    def test_list_objects_raises_on_pgerror(self, mock_get_conn):
        # type: (MagicMock) -> None

        # Arrange
        exception = TestPGErrors.TestException()
        mock_get_conn.return_value.cursor.return_value = cursor = MagicMock()
        cursor.execute.side_effect = exception

        # Act
        with self.assertRaises(DBException):
            db.list_objects('', '', '', '', '', '')
Beispiel #2
0
    def test_list_objects_raises_on_no_results(self,
                                               mock_jinja_env,
                                               mock_get_conn):
        # type: (MagicMock, MagicMock) -> None
        # Arrange
        mock_get_conn.return_value.cursor.return_value = cursor = MagicMock()

        cursor.fetchone.return_value = None

        # Act
        with self.assertRaises(NotFoundException):
            db.list_objects("classname", ["uuid"],
                            "virkning_fra", "virkning_til",
                            "registrering_fra",
                            "registrering_til")