Skip to content

Commit

Permalink
002
Browse files Browse the repository at this point in the history
  • Loading branch information
gitofanindya committed Nov 20, 2023
1 parent 2392bae commit 3bf7738
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions tests/functional/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,71 @@ def mocked_open_authentication_dialog():
True,
)
assert not returned_val


def test_get_features_list(manager_factory):
manager = manager_factory(with_engine=False)
manager.application = ""

def mocked_open_authentication_dialog():
return

Mocked_App = namedtuple(
"app",
"manager, open_authentication_dialog",
defaults=(manager, mocked_open_authentication_dialog),
)
app = Mocked_App()
drive_api = QMLDriveApi(app)

with manager:
returned_val = drive_api.get_features_list()
assert returned_val


def test_generate_report(manager_factory):
manager = manager_factory(with_engine=False)
manager.application = ""

def mocked_open_authentication_dialog():
return

def func(*args):
return 1 / 0

Mocked_App = namedtuple(
"app",
"manager, open_authentication_dialog",
defaults=(manager, mocked_open_authentication_dialog),
)
app = Mocked_App()
drive_api = QMLDriveApi(app)

with manager:
with patch.object(manager, "generate_report", new=func):
returned_val = drive_api.generate_report()
assert not returned_val


def test_get_disk_space_info_to_width(manager_factory):
manager, engine = manager_factory()
manager.application = ""

def mocked_open_authentication_dialog():
return

def func(*args):
return 100, 200

Mocked_App = namedtuple(
"app",
"manager, open_authentication_dialog",
defaults=(manager, mocked_open_authentication_dialog),
)
app = Mocked_App()
drive_api = QMLDriveApi(app)

with manager:
with patch.object(engine, "disk_space", new=func):
returned_val = drive_api.get_disk_space_info_to_width()
assert not returned_val

0 comments on commit 3bf7738

Please sign in to comment.