Skip to content

Commit

Permalink
NXDRIVE-2912: Display Drive notification for document review --20/06 …
Browse files Browse the repository at this point in the history
…-03 02
  • Loading branch information
gitofanindya committed Jun 20, 2024
1 parent 07cd4c7 commit 32ce90e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions nxdrive/gui/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,8 @@ def get_disk_space_info_to_width(
- Global size of synchronized files converted to percentage of the width.
"""
engine = self._get_engine(uid)
if not engine:
return []

synced = engine.dao.get_global_size() if engine else 0
used, free = disk_space(path)
Expand Down Expand Up @@ -621,6 +623,9 @@ def _balance_percents(self, result: Dict[str, float], /) -> Dict[str, float]:
def get_drive_disk_space(self, uid: str, /) -> str:
"""Fetch the global size of synchronized files and return a formatted version."""
engine = self._get_engine(uid)
if not engine:
return ""

synced = engine.dao.get_global_size() if engine else 0
return sizeof_fmt(synced, suffix=Translator.get("BYTE_ABBREV"))

Expand All @@ -634,6 +639,9 @@ def get_free_disk_space(self, path: str, /) -> str:
def get_used_space_without_synced(self, uid: str, path: str, /) -> str:
"""Fetch the size of space used by other applications and return a formatted version."""
engine = self._get_engine(uid)
if not engine:
return ""

synced = engine.dao.get_global_size() if engine else 0
used, _ = disk_space(path)
return sizeof_fmt(used - synced, suffix=Translator.get("BYTE_ABBREV"))
Expand Down
2 changes: 2 additions & 0 deletions tests/functional/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ def mocked_open_authentication_dialog():
with manager:
returned_val = drive_api.get_text("{'id': '1', \"price\": '2000'}", "price")
assert returned_val == "2000"
returned_val = drive_api.get_text("dummy_text", "dummy")
assert returned_val == ""


def test_text_red(manager_factory):
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/test_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,6 @@ def translate(message: str, /, *, values: List[Any] = None) -> str:

dummy_task_list = [dummy_task1, dummy_task2]
assert not tasks_model.loadList(dummy_task_list, "Administrator")

dummy_task_list = [dummy_task2]
assert not tasks_model.loadList(dummy_task_list, "Administrator")

0 comments on commit 32ce90e

Please sign in to comment.