mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-29 15:31:28 +00:00
fix tests
This commit is contained in:
parent
8d21cdcb2b
commit
3c63ab2657
|
@ -1,13 +1,10 @@
|
|||
import pytest
|
||||
from selfprivacy_api.graphql.mutations.mutation_interface import (
|
||||
GenericMutationReturn,
|
||||
)
|
||||
|
||||
|
||||
class BlockDeviceMockReturnNone:
|
||||
"""Mock BlockDevices"""
|
||||
|
||||
def __init__(self, args, **kwargs):
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.args = args
|
||||
self.kwargs = kwargs
|
||||
|
||||
|
@ -26,7 +23,7 @@ class BlockDeviceMockReturnNone:
|
|||
class BlockDeviceMockReturnTrue:
|
||||
"""Mock BlockDevices"""
|
||||
|
||||
def __init__(self, args, **kwargs):
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.args = args
|
||||
self.kwargs = kwargs
|
||||
|
||||
|
@ -45,7 +42,7 @@ class BlockDeviceMockReturnTrue:
|
|||
class BlockDeviceMockReturnFalse:
|
||||
"""Mock BlockDevices"""
|
||||
|
||||
def __init__(self, args, **kwargs):
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.args = args
|
||||
self.kwargs = kwargs
|
||||
|
||||
|
@ -62,8 +59,8 @@ class BlockDeviceMockReturnFalse:
|
|||
|
||||
|
||||
class BlockDevicesMockReturnTrue:
|
||||
def get_block_device(self, name: str):
|
||||
return True
|
||||
def get_block_device(name: str): # type: ignore
|
||||
return BlockDeviceMockReturnTrue()
|
||||
|
||||
def __new__(cls, *args, **kwargs):
|
||||
pass
|
||||
|
@ -73,7 +70,7 @@ class BlockDevicesMockReturnTrue:
|
|||
|
||||
|
||||
class BlockDevicesMockReturnNone:
|
||||
def get_block_device(self, name: str):
|
||||
def get_block_device(name: str): # type: ignore
|
||||
return None
|
||||
|
||||
def __new__(cls, *args, **kwargs):
|
||||
|
@ -86,7 +83,8 @@ class BlockDevicesMockReturnNone:
|
|||
@pytest.fixture
|
||||
def mock_block_devices_return_true(mocker):
|
||||
mock = mocker.patch(
|
||||
"selfprivacy_api.utils.block_devices.BlockDevices",
|
||||
"selfprivacy_api.graphql.mutations.storage_mutations.BlockDevices",
|
||||
# "selfprivacy_api.utils.block_devices.BlockDevices",
|
||||
autospec=True,
|
||||
return_value=BlockDevicesMockReturnTrue,
|
||||
)
|
||||
|
@ -328,7 +326,7 @@ def test_graphql_unmount_volume_false(
|
|||
assert response.json()["data"]["unmountVolume"]["success"] is False
|
||||
|
||||
|
||||
def test_graphql_unmount_volume(authorized_client, mock_block_devices_return_none):
|
||||
def test_graphql_unmount_volume(authorized_client, mock_block_devices_return_true):
|
||||
response = authorized_client.post(
|
||||
"/graphql",
|
||||
json={
|
||||
|
|
|
@ -94,9 +94,7 @@ def test_graphql_remove_job(
|
|||
json={
|
||||
"query": API_REMOVE_JOB_MUTATION,
|
||||
"variables": {
|
||||
"Job": {
|
||||
"uid": "12345",
|
||||
},
|
||||
"jobId": "12345",
|
||||
},
|
||||
},
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue