Correctly convert bugzilla date to arrow
Bugzilla returns xmlrpc.client.DateTime object instead of just datetime. Let's adjust the conversion to this fact. Signed-off-by: Michal Konečný <mkonecny@redhat.com>
This commit is contained in:
parent
869e71ba92
commit
4a9894c86a
2 changed files with 7 additions and 6 deletions
|
@ -5,6 +5,7 @@ import json
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
from unittest.mock import call, MagicMock, Mock, patch
|
from unittest.mock import call, MagicMock, Mock, patch
|
||||||
|
import xmlrpc.client
|
||||||
|
|
||||||
import arrow
|
import arrow
|
||||||
from pagure_messages.issue_schema import IssueCommentAddedV1, IssueNewV1
|
from pagure_messages.issue_schema import IssueCommentAddedV1, IssueNewV1
|
||||||
|
@ -2572,9 +2573,9 @@ class TestValidateReviewBug:
|
||||||
"name": "fedora-review",
|
"name": "fedora-review",
|
||||||
"status": "",
|
"status": "",
|
||||||
"setter": assignee,
|
"setter": assignee,
|
||||||
"modification_date": arrow.utcnow()
|
"modification_date": xmlrpc.client.DateTime(
|
||||||
.shift(days=-61)
|
arrow.utcnow().shift(days=-61).datetime
|
||||||
.format("YYYY-MM-DDTHH-mm-ssZ"),
|
),
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -2687,7 +2688,7 @@ class TestValidateReviewBug:
|
||||||
"name": "fedora-review",
|
"name": "fedora-review",
|
||||||
"status": "+",
|
"status": "+",
|
||||||
"setter": assignee,
|
"setter": assignee,
|
||||||
"modification_date": arrow.utcnow().format("YYYY-MM-DDTHH-mm-ssZ"),
|
"modification_date": xmlrpc.client.DateTime(arrow.utcnow().datetime),
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -2743,7 +2744,7 @@ class TestValidateReviewBug:
|
||||||
"name": "fedora-review",
|
"name": "fedora-review",
|
||||||
"status": "+",
|
"status": "+",
|
||||||
"setter": assignee,
|
"setter": assignee,
|
||||||
"modification_date": arrow.utcnow().format("YYYY-MM-DDTHH-mm-ssZ"),
|
"modification_date": xmlrpc.client.DateTime(arrow.utcnow().datetime),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "random-flag",
|
"name": "random-flag",
|
||||||
|
|
|
@ -963,7 +963,7 @@ class SCMRequestProcessor(ToddlerBase):
|
||||||
|
|
||||||
update_dt = flag.get("modification_date")
|
update_dt = flag.get("modification_date")
|
||||||
if update_dt:
|
if update_dt:
|
||||||
dt = arrow.get(update_dt, "YYYY-MM-DDTHH-mm-ssZ")
|
dt = arrow.get(update_dt.value, "YYYYMMDDTHH:mm:ss")
|
||||||
delta = arrow.utcnow().date() - dt.date()
|
delta = arrow.utcnow().date() - dt.date()
|
||||||
if delta.days > 60:
|
if delta.days > 60:
|
||||||
raise ValidationError(
|
raise ValidationError(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue