Skip to content

Commit fcaefc1

Browse files
Use the client to deserialize the parameter (#2517)
* Use the client to deserialize the parameter * Update conftest.py * Update conftest.py * Try out removing skip-python
1 parent 502ff79 commit fcaefc1

File tree

2 files changed

+9
-16
lines changed

2 files changed

+9
-16
lines changed

Diff for: tests/conftest.py

+7-14
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def unique(request, freezed_time):
161161
return f"{prefix}-{int(freezed_time.timestamp())}"
162162

163163

164-
def relative_time(freezed_time, iso, is_iso_with_timezone_indicator):
164+
def relative_time(freezed_time, iso):
165165
time_re = re.compile(r"now( *([+-]) *(\d+)([smhdMy]))?")
166166

167167
def func(arg):
@@ -185,16 +185,9 @@ def func(arg):
185185
elif unit == "y":
186186
ret += relativedelta(years=num)
187187
if iso:
188-
if is_iso_with_timezone_indicator:
189-
# Return ISO 8601 formatted string with Z timezone indicator
190-
# Example: 2025-04-17T03:17:07.923Z
191-
from datetime import timezone
192-
193-
return ret.astimezone(timezone.utc).isoformat(timespec="milliseconds").replace("+00:00", "Z")
194-
else:
195-
return ret.replace(tzinfo=None) # return datetime object and not string
196-
# NOTE this is not a full ISO 8601 format, but it's enough for our needs
197-
# return ret.strftime('%Y-%m-%dT%H:%M:%S') + ret.strftime('.%f')[:4] + 'Z'
188+
return ret.replace(tzinfo=None) # return datetime object and not string
189+
# NOTE this is not a full ISO 8601 format, but it's enough for our needs
190+
# return ret.strftime('%Y-%m-%dT%H:%M:%S') + ret.strftime('.%f')[:4] + 'Z'
198191

199192
return int(ret.timestamp())
200193
return ""
@@ -227,8 +220,8 @@ def context(vcr, unique, freezed_time):
227220
"unique_lower_alnum": PATTERN_ALPHANUM.sub("", unique).lower(),
228221
"unique_upper_alnum": PATTERN_ALPHANUM.sub("", unique).upper(),
229222
"unique_hash": unique_hash,
230-
"timestamp": relative_time(freezed_time, False, False),
231-
"timeISO": relative_time(freezed_time, True, is_iso_with_timezone_indicator),
223+
"timestamp": relative_time(freezed_time, False),
224+
"timeISO": relative_time(freezed_time, True),
232225
"uuid": generate_uuid(freezed_time),
233226
}
234227

@@ -512,7 +505,7 @@ def build_param(p):
512505
json.loads(Template(p["value"]).render(**context)),
513506
)
514507
return open(filepath)
515-
return json.loads(Template(p["value"]).render(**context))
508+
return client.deserialize(Template(p["value"]).render(**context), openapi_types, True)
516509
if "source" in p:
517510
return glom(context, p["source"])
518511

Diff for: tests/v2/features/on-call.feature

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Feature: On-Call
3333
When the request is sent
3434
Then the response status is 400 Bad Request
3535

36-
@skip-python @team:DataDog/bugle
36+
@team:DataDog/bugle
3737
Scenario: Create on-call schedule returns "Created" response
3838
Given new "CreateOnCallSchedule" request
3939
And there is a valid "user" in the system
@@ -159,7 +159,7 @@ Feature: On-Call
159159
When the request is sent
160160
Then the response status is 404 Not Found
161161

162-
@skip-python @team:DataDog/bugle
162+
@team:DataDog/bugle
163163
Scenario: Update on-call schedule returns "OK" response
164164
Given new "UpdateOnCallSchedule" request
165165
And there is a valid "schedule" in the system

0 commit comments

Comments
 (0)