forked from p15670423/monkey
UT: Move OpenErrorFileRepository into tests/monkey_island
This commit is contained in:
parent
47df257545
commit
4de9f3cb6d
|
@ -1 +1,3 @@
|
|||
from .single_file_repository import SingleFileRepository
|
||||
from .mock_file_repository import MockFileRepository, FILE_CONTENTS, FILE_NAME
|
||||
from .open_error_file_repository import OpenErrorFileRepository
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
from typing import BinaryIO
|
||||
|
||||
from monkey_island.cc.repository import RetrievalError
|
||||
|
||||
from . import MockFileRepository
|
||||
|
||||
|
||||
class OpenErrorFileRepository(MockFileRepository):
|
||||
def open_file(self, unsafe_file_name: str) -> BinaryIO:
|
||||
raise RetrievalError("Error retrieving file")
|
|
@ -1,17 +1,15 @@
|
|||
from typing import BinaryIO
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
import flask_jwt_extended
|
||||
import pytest
|
||||
from tests.common import StubDIContainer
|
||||
from tests.monkey_island import OpenErrorFileRepository
|
||||
from tests.unit_tests.monkey_island.conftest import init_mock_app
|
||||
|
||||
import monkey_island.cc.app
|
||||
import monkey_island.cc.resources.auth.auth
|
||||
import monkey_island.cc.resources.island_mode
|
||||
from monkey_island.cc.repository import IFileRepository, RetrievalError
|
||||
|
||||
from .mock_file_repository import MockFileRepository
|
||||
from monkey_island.cc.repository import IFileRepository
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
@ -45,11 +43,6 @@ def get_mock_app(container):
|
|||
return app
|
||||
|
||||
|
||||
class OpenErrorFileRepository(MockFileRepository):
|
||||
def open_file(self, unsafe_file_name: str) -> BinaryIO:
|
||||
raise RetrievalError("Error retrieving file")
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def open_error_flask_client(build_flask_client):
|
||||
container = StubDIContainer()
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
import pytest
|
||||
from tests.common import StubDIContainer
|
||||
from tests.monkey_island import FILE_CONTENTS, FILE_NAME, MockFileRepository
|
||||
from tests.unit_tests.monkey_island.conftest import get_url_for_resource
|
||||
|
||||
from monkey_island.cc.repository import IFileRepository
|
||||
from monkey_island.cc.resources.pba_file_download import PBAFileDownload
|
||||
|
||||
from .mock_file_repository import FILE_CONTENTS, FILE_NAME, MockFileRepository
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def flask_client(build_flask_client):
|
||||
|
|
Loading…
Reference in New Issue