Skip to content

Commit f03313e

Browse files
committed
Fix the unit tests
1 parent 05e177d commit f03313e

33 files changed

+435
-342
lines changed

src/wiotp/sdk/api/dsc/connectors.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,16 @@ def __init__(self, apiClient):
7979
def find(self, nameFilter=None, typeFilter=None, enabledFilter=None, serviceId=None):
8080
"""
8181
Gets the list of Historian connectors, they are used to configure the Watson IoT Platform to store IoT data in compatible services.
82-
82+
8383
Parameters:
84-
84+
8585
- nameFilter(string) - Filter the results by the specified name
8686
- typeFilter(string) - Filter the results by the specified type, Available values : cloudant, eventstreams
87-
- enabledFilter(boolean) - Filter the results by the enabled flag
87+
- enabledFilter(boolean) - Filter the results by the enabled flag
8888
- serviceId(string) - Filter the results by the service id
8989
- limit(number) - Max number of results returned, defaults 25
9090
- bookmark(string) - used for paging through results
91-
91+
9292
Throws APIException on failure.
9393
"""
9494

@@ -106,7 +106,7 @@ def find(self, nameFilter=None, typeFilter=None, enabledFilter=None, serviceId=N
106106

107107
def create(self, name, type, serviceId, timezone=None, description=None, enabled=None, configuration=None):
108108
"""
109-
Create a connector for the organization in the Watson IoT Platform.
109+
Create a connector for the organization in the Watson IoT Platform.
110110
The connector must reference the target service that the Watson IoT Platform will store the IoT data in.
111111
Parameters:
112112
- name (string) - Name of the service

src/wiotp/sdk/api/registry/diag.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@
1111
import json
1212
from datetime import datetime
1313
from collections import defaultdict
14+
1415
try:
15-
from collections.abc import MutableSequence
16+
from collections.abc import MutableSequence
1617
except ImportError:
17-
from collections import MutableSequence
18+
from collections import MutableSequence
1819
from wiotp.sdk.exceptions import ApiException
1920

2021

src/wiotp/sdk/api/services/__init__.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,16 +165,16 @@ def __init__(self, apiClient):
165165

166166
def find(self, nameFilter=None, typeFilter=None, bindingModeFilter=None, boundFilter=None):
167167
"""
168-
Gets the list of services that the Watson IoT Platform can connect to.
168+
Gets the list of services that the Watson IoT Platform can connect to.
169169
The list can include a mixture of services that are either bound or unbound.
170-
170+
171171
Parameters:
172-
172+
173173
- nameFilter(string) - Filter the results by the specified name
174174
- typeFilter(string) - Filter the results by the specified type, Available values : cloudant, eventstreams
175175
- bindingModeFilter(string) - Filter the results by the specified binding mode, Available values : automatic, manual
176-
- boundFilter(boolean) - Filter the results by the bound flag
177-
176+
- boundFilter(boolean) - Filter the results by the bound flag
177+
178178
Throws APIException on failure.
179179
"""
180180

@@ -192,9 +192,9 @@ def find(self, nameFilter=None, typeFilter=None, bindingModeFilter=None, boundFi
192192

193193
def create(self, serviceBinding):
194194
"""
195-
Create a new external service.
196-
The service must include all of the details required to connect
197-
and authenticate to the external service in the credentials property.
195+
Create a new external service.
196+
The service must include all of the details required to connect
197+
and authenticate to the external service in the credentials property.
198198
Parameters:
199199
- serviceName (string) - Name of the service
200200
- serviceType (string) - must be either eventstreams or cloudant

src/wiotp/sdk/api/state/deviceTypes.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from wiotp.sdk.api.state.logicalInterfaces import BaseLogicalInterface
2222
from wiotp.sdk.api.state.physicalInterfaces import PhysicalInterface
2323

24+
2425
# =========================================================================
2526
# Physical Interface for the Device Type
2627
# =========================================================================
@@ -166,6 +167,7 @@ def __init__(self, apiClient, deviceTypeId):
166167
# Mappings for the Device Type
167168
# =========================================================================
168169

170+
169171
# define the common properties found on most Rest API Items
170172
class DeviceTypeMapping(defaultdict):
171173
def __init__(self, **kwargs):

src/wiotp/sdk/api/state/schemas.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ def __init__(self, apiClient):
7878
super(DraftSchemas, self).__init__(apiClient, Schema, IterableSchemaList, "api/v0002/draft/schemas")
7979

8080
def create(self, name, schemaFileName, schemaContents, description):
81-
8281
"""
8382
Create a schema for the org.
8483
Returns: schemaId (string), response (object).

src/wiotp/sdk/api/state/thingTypes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ def __init__(self, apiClient, thingTypeId):
179179
# Mappings for the Thing Type
180180
# =========================================================================
181181

182+
182183
# define the common properties found on most Rest API Items
183184
class ThingTypeMapping(defaultdict):
184185
def __init__(self, **kwargs):

src/wiotp/sdk/application/config.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818

1919
class ApplicationClientConfig(defaultdict):
2020
def __init__(self, **kwargs):
21-
if "auth" not in kwargs or kwargs["auth"] is None:
21+
# previously quickstart supported unauthenticated connections but has been removed
22+
if "auth" not in kwargs:
2223
raise ConfigurationException("Missing auth from configuration")
23-
2424
if "key" not in kwargs["auth"] or kwargs["auth"]["key"] is None:
2525
raise ConfigurationException("Missing auth.key from configuration")
2626
if "token" not in kwargs["auth"] or kwargs["auth"]["token"] is None:
@@ -248,6 +248,11 @@ def parseEnvVars():
248248
"auth": {"key": authKey, "token": authToken}
249249
}
250250

251+
<<<<<<< HEAD
252+
=======
253+
cfg["auth"] = {"key": authKey, "token": authToken}
254+
255+
>>>>>>> 1ec819d (Fix the unit tests)
251256
return ApplicationClientConfig(**cfg)
252257

253258

src/wiotp/sdk/client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ def __init__(
132132
# paho 2.0.0 has a breaking change for callbacks to support both 2.0.0 and 1.x we need
133133
# to create a client in version1 mode if using 2.0.0
134134
if pahoVersion >= "2.0.0":
135-
self.client = paho.Client(paho.CallbackAPIVersion.VERSION1, self.clientId, transport=transport, clean_session=(not cleanStart))
135+
self.client = paho.Client(
136+
paho.CallbackAPIVersion.VERSION1, self.clientId, transport=transport, clean_session=(not cleanStart)
137+
)
136138
else:
137139
self.client = paho.Client(self.clientId, transport=transport, clean_session=(not cleanStart))
138140

src/wiotp/sdk/device/command.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,20 @@
1515
class Command:
1616
"""
1717
Represents a command sent to a device.
18-
18+
1919
# Parameters
2020
pahoMessage (?): ?
21-
messageEncoderModules (dict): Dictionary of Python modules, keyed to the
22-
message format the module should use.
23-
21+
messageEncoderModules (dict): Dictionary of Python modules, keyed to the
22+
message format the module should use.
23+
2424
# Attributes
2525
command (string): Identifies the command.
2626
format (string): The format can be any string, for example JSON.
2727
data (dict): The data for the payload. Maximum length is 131072 bytes.
2828
timestamp (datetime): The date and time of the event.
2929
3030
# Raises
31-
InvalidEventException: If the command was recieved on a topic that does
31+
InvalidEventException: If the command was recieved on a topic that does
3232
not match the regular expression `iot-2/cmd/(.+)/fmt/(.+)`
3333
"""
3434

src/wiotp/sdk/device/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,8 @@ def parseEnvVars():
216216
"auth": {"token": authToken}
217217
}
218218

219+
cfg["auth"] = {"token": authToken}
220+
219221
return DeviceClientConfig(**cfg)
220222

221223

0 commit comments

Comments
 (0)