Merge pull request #194 from dfeinzeig/patch-2
some IdPs (for example OneLogin seem to exclude the trailing Z in the Is...
This commit is contained in:
@@ -16,7 +16,7 @@ from datetime import datetime
|
|||||||
|
|
||||||
TIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
|
TIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
|
||||||
TIME_FORMAT_WITH_FRAGMENT = re.compile(
|
TIME_FORMAT_WITH_FRAGMENT = re.compile(
|
||||||
"^(\d{4,4}-\d{2,2}-\d{2,2}T\d{2,2}:\d{2,2}:\d{2,2})\.\d*Z$")
|
"^(\d{4,4}-\d{2,2}-\d{2,2}T\d{2,2}:\d{2,2}:\d{2,2})(\.\d*)?Z?$")
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# I'm sure this is implemented somewhere else can't find it now though, so I
|
# I'm sure this is implemented somewhere else can't find it now though, so I
|
||||||
|
|||||||
@@ -123,7 +123,9 @@ def test_str_to_time():
|
|||||||
#TODO: add something to show how this time was arrived at
|
#TODO: add something to show how this time was arrived at
|
||||||
# do this as an external method in the
|
# do this as an external method in the
|
||||||
assert t == 947635200
|
assert t == 947635200
|
||||||
|
# some IdPs omit the trailing Z, and SAML spec is unclear if it is actually required
|
||||||
|
t = calendar.timegm(str_to_time("2000-01-12T00:00:00"))
|
||||||
|
assert t == 947635200
|
||||||
|
|
||||||
def test_instant():
|
def test_instant():
|
||||||
inst = str_to_time(instant())
|
inst = str_to_time(instant())
|
||||||
|
|||||||
Reference in New Issue
Block a user