mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-25 21:41:27 +00:00
test(services): test derivation of foldermoves
This commit is contained in:
parent
7a5af6af99
commit
f09d21a031
|
@ -24,7 +24,7 @@ class FolderMoveNames(BaseModel):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def from_owned_path(path: OwnedPath) -> FolderMoveNames:
|
def from_owned_path(path: OwnedPath) -> FolderMoveNames:
|
||||||
return FolderMoveNames(
|
return FolderMoveNames(
|
||||||
name=FolderMoveNames.get_foldername(),
|
name=FolderMoveNames.get_foldername(path.path),
|
||||||
bind_location=path.path,
|
bind_location=path.path,
|
||||||
owner=path.owner,
|
owner=path.owner,
|
||||||
group=path.group,
|
group=path.group,
|
||||||
|
|
|
@ -6,6 +6,7 @@ from pytest import raises
|
||||||
from selfprivacy_api.services.bitwarden import Bitwarden
|
from selfprivacy_api.services.bitwarden import Bitwarden
|
||||||
from selfprivacy_api.services.pleroma import Pleroma
|
from selfprivacy_api.services.pleroma import Pleroma
|
||||||
from selfprivacy_api.services.owned_path import OwnedPath
|
from selfprivacy_api.services.owned_path import OwnedPath
|
||||||
|
from selfprivacy_api.services.generic_service_mover import FolderMoveNames
|
||||||
|
|
||||||
from selfprivacy_api.services.test_service import DummyService
|
from selfprivacy_api.services.test_service import DummyService
|
||||||
from selfprivacy_api.services.service import Service
|
from selfprivacy_api.services.service import Service
|
||||||
|
@ -40,3 +41,18 @@ def test_paths_from_owned_paths():
|
||||||
assert Pleroma.get_folders() == [
|
assert Pleroma.get_folders() == [
|
||||||
ownedpath.path for ownedpath in Pleroma.get_owned_folders()
|
ownedpath.path for ownedpath in Pleroma.get_owned_folders()
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def test_foldermoves_from_ownedpaths():
|
||||||
|
owned = OwnedPath(
|
||||||
|
path="var/lib/bitwarden",
|
||||||
|
group="vaultwarden",
|
||||||
|
owner="vaultwarden",
|
||||||
|
)
|
||||||
|
|
||||||
|
assert FolderMoveNames.from_owned_path(owned) == FolderMoveNames(
|
||||||
|
name="bitwarden",
|
||||||
|
bind_location="var/lib/bitwarden",
|
||||||
|
group="vaultwarden",
|
||||||
|
owner="vaultwarden",
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in a new issue