STAR-322: Using a test setup to run tests with Cura app

This commit is contained in:
Daniel Schiavini 2018-12-10 13:11:42 +01:00
parent 134f97d5f1
commit f432d7c858
5 changed files with 58 additions and 17 deletions

View file

@ -66,7 +66,8 @@ class NetworkManagerMock:
# \return The data in the response.
def prepareGetClusters(self, data: Optional[dict] = None) -> dict:
data, response = self._getResponseData("clusters", data)
self.prepareReply("GET", "https://api-staging.ultimaker.com/connect/v1/clusters", 200, response)
status_code = 200 if "data" in data else int(data["errors"][0]["http_status"])
self.prepareReply("GET", "https://api-staging.ultimaker.com/connect/v1/clusters", status_code, response)
return data
## Gets the data that should be in the server's response in both dictionary and JSON-encoded bytes format.
@ -87,6 +88,7 @@ class NetworkManagerMock:
def flushReplies(self):
for reply in self.replies.values():
self.finished.emit(reply)
self.reset()
## Deletes all prepared replies
def reset(self):