Skip to content

Commit e38b86d

Browse files
Reverted external_id field to string
1 parent 12a40c6 commit e38b86d

File tree

5 files changed

+12
-7
lines changed

5 files changed

+12
-7
lines changed

connect/models/asset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def get_item_by_id(self, identity):
2424

2525
class AssetSchema(BaseSchema):
2626
status = fields.Str()
27-
external_id = fields.Int()
27+
external_id = fields.Str()
2828
external_uid = fields.UUID()
2929
product = fields.Nested(ProductSchema, only=('id', 'name'))
3030
connection = fields.Nested(

connect/models/hub.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ def make_object(self, data):
2424

2525
class HubsSchemaMixin(Schema):
2626
hub = fields.Nested(HubSchema, only=('id', 'name'))
27-
external_id = fields.Int()
27+
external_id = fields.Str()

connect/models/tiers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Tier(BaseModel):
1818
class TierSchema(BaseSchema):
1919
name = fields.Str()
2020
contact_info = fields.Nested(ContactInfoSchema)
21-
external_id = fields.Int()
21+
external_id = fields.Str()
2222
external_uid = fields.UUID()
2323

2424
@post_load

tests/response2.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"name": "Marc FSG"
1414
}
1515
},
16-
"external_id": 899,
16+
"external_id": "899",
1717
"id": "AS-893-495-635-9",
1818
"items": [
1919
{
@@ -105,7 +105,7 @@
105105
"postal_code": "30690",
106106
"state": "Nevada"
107107
},
108-
"external_id": 889,
108+
"external_id": "889",
109109
"id": "TA-0-5870-9239-0029",
110110
"name": "Kaiser LLC"
111111
},
@@ -129,7 +129,7 @@
129129
"postal_code": "12111",
130130
"state": "Alaska"
131131
},
132-
"external_id": 1,
132+
"external_id": "1",
133133
"id": "TA-0-7251-3930-7482",
134134
"name": "ACME Reseller"
135135
},

tests/test_models.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,12 @@ def test_create_model_from_response():
7575
assert request_obj.marketplace.id == content['marketplace']['id']
7676
assert request_obj.asset.id == content['asset']['id']
7777
assert request_obj.asset.product.id == content['asset']['product']['id']
78-
assert isinstance(request_obj.asset.external_id, int)
78+
try:
79+
# Python 2
80+
assert isinstance(request_obj.asset.external_id, basestring)
81+
except NameError:
82+
# Python 3
83+
assert isinstance(request_obj.asset.external_id, str)
7984

8085

8186
@patch('requests.get', MagicMock(return_value=_get_response2_ok()))

0 commit comments

Comments
 (0)