Actually fix tests

Contributes to CL-1266
This commit is contained in:
Ian Paschal 2019-03-29 12:27:58 +01:00
parent 4581c1f138
commit 58f1c05564
3 changed files with 5 additions and 4 deletions

View file

@ -16,7 +16,7 @@ class CloudClusterResponse(BaseCloudModel):
# \param status: The status of the cluster authentication (active or inactive). # \param status: The status of the cluster authentication (active or inactive).
# \param host_version: The firmware version of the cluster host. This is where the Stardust client is running on. # \param host_version: The firmware version of the cluster host. This is where the Stardust client is running on.
def __init__(self, cluster_id: str, host_guid: str, host_name: str, is_online: bool, status: str, def __init__(self, cluster_id: str, host_guid: str, host_name: str, is_online: bool, status: str,
host_internal_ip: Optional[str] = "", host_version: Optional[str] = None, **kwargs) -> None: host_internal_ip: Optional[str] = None, host_version: Optional[str] = None, **kwargs) -> None:
self.cluster_id = cluster_id self.cluster_id = cluster_id
self.host_guid = host_guid self.host_guid = host_guid
self.host_name = host_name self.host_name = host_name

View file

@ -4,7 +4,6 @@
"host_guid": "e90ae0ac-1257-4403-91ee-a44c9b7e8050", "host_guid": "e90ae0ac-1257-4403-91ee-a44c9b7e8050",
"host_name": "ultimakersystem-ccbdd30044ec", "host_name": "ultimakersystem-ccbdd30044ec",
"host_version": "5.0.0.20170101", "host_version": "5.0.0.20170101",
"host_internal_ip": "",
"is_online": true, "is_online": true,
"status": "active" "status": "active"
}, { }, {
@ -12,7 +11,6 @@
"host_guid": "e0ace90a-91ee-1257-4403-e8050a44c9b7", "host_guid": "e0ace90a-91ee-1257-4403-e8050a44c9b7",
"host_name": "ultimakersystem-30044ecccbdd", "host_name": "ultimakersystem-30044ecccbdd",
"host_version": "5.1.2.20180807", "host_version": "5.1.2.20180807",
"host_internal_ip": "",
"is_online": true, "is_online": true,
"status": "active" "status": "active"
}] }]

View file

@ -7,6 +7,7 @@ from UM.OutputDevice.OutputDeviceManager import OutputDeviceManager
from cura.UltimakerCloudAuthentication import CuraCloudAPIRoot from cura.UltimakerCloudAuthentication import CuraCloudAPIRoot
from ...src.Cloud import CloudApiClient from ...src.Cloud import CloudApiClient
from ...src.Cloud import CloudOutputDeviceManager from ...src.Cloud import CloudOutputDeviceManager
from ...src.Cloud.Models.CloudClusterResponse import CloudClusterResponse
from .Fixtures import parseFixture, readFixture from .Fixtures import parseFixture, readFixture
from .NetworkManagerMock import NetworkManagerMock, FakeSignal from .NetworkManagerMock import NetworkManagerMock, FakeSignal
@ -55,7 +56,9 @@ class TestCloudOutputDeviceManager(TestCase):
devices = self.device_manager.getOutputDevices() devices = self.device_manager.getOutputDevices()
# TODO: Check active device # TODO: Check active device
response_clusters = self.clusters_response.get("data", []) response_clusters = []
for cluster in self.clusters_response.get("data", []):
response_clusters.append(CloudClusterResponse(**cluster).toDict())
manager_clusters = sorted([device.clusterData.toDict() for device in self.manager._remote_clusters.values()], manager_clusters = sorted([device.clusterData.toDict() for device in self.manager._remote_clusters.values()],
key=lambda cluster: cluster['cluster_id'], reverse=True) key=lambda cluster: cluster['cluster_id'], reverse=True)
self.assertEqual(response_clusters, manager_clusters) self.assertEqual(response_clusters, manager_clusters)