mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 23:46:22 -06:00
Try other patch values for relative imports
This commit is contained in:
parent
d9a8bb0eb7
commit
aab1fbc73f
4 changed files with 6 additions and 9 deletions
|
@ -28,7 +28,7 @@ class TestCloudApiClient(TestCase):
|
||||||
self.account.isLoggedIn.return_value = True
|
self.account.isLoggedIn.return_value = True
|
||||||
|
|
||||||
self.network = NetworkManagerMock()
|
self.network = NetworkManagerMock()
|
||||||
with patch("plugins.UM3NetworkPrinting.src.Cloud.CloudApiClient.QNetworkAccessManager", return_value = self.network):
|
with patch("CloudApiClient.QNetworkAccessManager", return_value = self.network):
|
||||||
self.api = CloudApiClient(self.account, self._errorHandler)
|
self.api = CloudApiClient(self.account, self._errorHandler)
|
||||||
|
|
||||||
def test_getClusters(self):
|
def test_getClusters(self):
|
||||||
|
|
|
@ -41,7 +41,7 @@ class TestCloudOutputDevice(TestCase):
|
||||||
self.network = NetworkManagerMock()
|
self.network = NetworkManagerMock()
|
||||||
self.account = MagicMock(isLoggedIn=True, accessToken="TestAccessToken")
|
self.account = MagicMock(isLoggedIn=True, accessToken="TestAccessToken")
|
||||||
self.onError = MagicMock()
|
self.onError = MagicMock()
|
||||||
with patch("plugins.UM3NetworkPrinting.src.Cloud.CloudApiClient.QNetworkAccessManager",
|
with patch("CloudApiClient.QNetworkAccessManager",
|
||||||
return_value = self.network):
|
return_value = self.network):
|
||||||
self._api = CloudApiClient(self.account, self.onError)
|
self._api = CloudApiClient(self.account, self.onError)
|
||||||
|
|
||||||
|
|
|
@ -28,10 +28,8 @@ class TestCloudOutputDeviceManager(TestCase):
|
||||||
|
|
||||||
self.network = NetworkManagerMock()
|
self.network = NetworkManagerMock()
|
||||||
self.timer = MagicMock(timeout = FakeSignal())
|
self.timer = MagicMock(timeout = FakeSignal())
|
||||||
with patch("plugins.UM3NetworkPrinting.src.Cloud.CloudApiClient.QNetworkAccessManager",
|
with patch("CloudApiClient.QNetworkAccessManager", return_value = self.network), \
|
||||||
return_value = self.network), \
|
patch("CloudOutputDeviceManager.QTimer", return_value = self.timer):
|
||||||
patch("plugins.UM3NetworkPrinting.src.Cloud.CloudOutputDeviceManager.QTimer",
|
|
||||||
return_value = self.timer):
|
|
||||||
self.manager = CloudOutputDeviceManager()
|
self.manager = CloudOutputDeviceManager()
|
||||||
self.clusters_response = parseFixture("getClusters")
|
self.clusters_response = parseFixture("getClusters")
|
||||||
self.network.prepareReply("GET", self.URL, 200, readFixture("getClusters"))
|
self.network.prepareReply("GET", self.URL, 200, readFixture("getClusters"))
|
||||||
|
@ -114,7 +112,7 @@ class TestCloudOutputDeviceManager(TestCase):
|
||||||
|
|
||||||
active_machine_mock.setMetaDataEntry.assert_called_with("um_cloud_cluster_id", cluster2["cluster_id"])
|
active_machine_mock.setMetaDataEntry.assert_called_with("um_cloud_cluster_id", cluster2["cluster_id"])
|
||||||
|
|
||||||
@patch("plugins.UM3NetworkPrinting.src.Cloud.CloudOutputDeviceManager.Message")
|
@patch("CloudOutputDeviceManager.Message")
|
||||||
def test_api_error(self, message_mock):
|
def test_api_error(self, message_mock):
|
||||||
self.clusters_response = {
|
self.clusters_response = {
|
||||||
"errors": [{"id": "notFound", "title": "Not found!", "http_status": "404", "code": "notFound"}]
|
"errors": [{"id": "notFound", "title": "Not found!", "http_status": "404", "code": "notFound"}]
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
# Copyright (c) 2018 Ultimaker B.V.
|
# Copyright (c) 2018 Ultimaker B.V.
|
||||||
# Copyright (c) 2018 Ultimaker B.V.
|
# Copyright (c) 2018 Ultimaker B.V.
|
||||||
# Cura is released under the terms of the LGPLv3 or higher.
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
import copy
|
|
||||||
import io
|
import io
|
||||||
import json
|
import json
|
||||||
from unittest import TestCase, mock
|
from unittest import TestCase, mock
|
||||||
|
@ -14,7 +13,7 @@ from UM.Application import Application
|
||||||
from cura.Machines.MaterialGroup import MaterialGroup
|
from cura.Machines.MaterialGroup import MaterialGroup
|
||||||
from cura.Machines.MaterialNode import MaterialNode
|
from cura.Machines.MaterialNode import MaterialNode
|
||||||
|
|
||||||
from plugins.UM3NetworkPrinting.src.SendMaterialJob import SendMaterialJob
|
from ..src.SendMaterialJob import SendMaterialJob
|
||||||
|
|
||||||
_FILES_MAP = {"generic_pla_white": "/materials/generic_pla_white.xml.fdm_material",
|
_FILES_MAP = {"generic_pla_white": "/materials/generic_pla_white.xml.fdm_material",
|
||||||
"generic_pla_black": "/materials/generic_pla_black.xml.fdm_material",
|
"generic_pla_black": "/materials/generic_pla_black.xml.fdm_material",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue