Skip to content
Snippets Groups Projects
Commit a5ac6555 authored by Bogdan Bodnar's avatar Bogdan Bodnar
Browse files

Fix tests.

parent 7d8165e8
No related merge requests found
Pipeline #50348 failed with stage
in 45 seconds
......@@ -59,13 +59,13 @@ class SettingsUci(BaseCmdLine, BaseFile):
)
return {
'uuid': uuid,
'old_uuid': old_uuid,
'old_device': old_device,
'formating': os.path.isfile(inject_file_root('/tmp/formating')),
'nextcloud_installed': os.path.isfile(inject_file_root('/srv/www/nextcloud/index.php')),
'nextcloud_configuring': os.path.isfile(inject_file_root('/tmp/nextcloud_configuring')),
'nextcloud_configured': os.path.isfile(inject_file_root('/srv/www/nextcloud/config/config.php'))
"uuid": uuid,
"old_uuid": old_uuid,
"old_device": old_device,
"formating": os.path.isfile(inject_file_root("/tmp/formating")),
"nextcloud_installed": os.path.isfile(inject_file_root("/srv/www/nextcloud/index.php")),
"nextcloud_configuring": os.path.isfile(inject_file_root("/tmp/nextcloud_configuring")),
"nextcloud_configured": os.path.isfile(inject_file_root("/srv/www/nextcloud/config/config.php"))
}
def update_srv(self, srv):
......
......@@ -33,6 +33,10 @@ class MockStorageHandler(Handler, BaseMockHandler):
uuid = ""
formatting = False
nextcloud_installed = False
nextcloud_configured = False
nextcloud_configuring = False
drives = [
{
"fs": "btrfs",
......@@ -49,6 +53,9 @@ class MockStorageHandler(Handler, BaseMockHandler):
"old_uuid": MockStorageHandler.old_uuid,
"uuid": MockStorageHandler.uuid,
"formating": MockStorageHandler.formatting,
"nextcloud_installed": MockStorageHandler.nextcloud_installed,
"nextcloud_configured": MockStorageHandler.nextcloud_configured,
"nextcloud_configuring": MockStorageHandler.nextcloud_configuring,
}
@logger_wrapper(logger)
......
......@@ -36,7 +36,15 @@
"nextcloud_configuring": {"type": "boolean"}
},
"additionalProperties": false,
"required": ["uuid", "old_uuid", "old_device", "formating" ]
"required": [
"uuid",
"old_uuid",
"old_device",
"formating",
"nextcloud_installed",
"nextcloud_configured",
"nextcloud_configuring"
]
}
},
"additionalProperties": false,
......
......@@ -108,6 +108,20 @@ def formatting_file(request):
else:
yield request.param
@pytest.fixture(scope="function")
def nextcloud_installed_file(request):
with FileFaker(FILE_ROOT_PATH, "/srv/www/nextcloud/index.php", False, "") as f:
yield f, request.param
@pytest.fixture(scope="function")
def nextcloud_configuring_file(request):
with FileFaker(FILE_ROOT_PATH, "/tmp/nextcloud_configuring", False, "") as f:
yield f, request.param
@pytest.fixture(scope="function")
def nextcloud_configured_file(request):
with FileFaker(FILE_ROOT_PATH, "/srv/www/nextcloud/config/config.php", False, "") as f:
yield f, request.param
@pytest.fixture(scope="function")
def prepare_srv_drive_sh_cmd(request):
......@@ -146,7 +160,13 @@ def test_get_settings(
else:
assert set(res["data"].keys()) == {
u"old_device", u"old_uuid", u"uuid", "formating", "nextcloud_configuring", "nextcloud_configured", "nextcloud_installed"
u"old_device",
u"old_uuid",
u"uuid",
u"formating",
u"nextcloud_configuring",
u"nextcloud_configured",
u"nextcloud_installed"
}
if infrastructure.backend_name != "mock":
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment