Update to_timeval usage to use format_iso8601

GLib.DateTime.to_timeval is deprecated.
This commit is contained in:
Brian C. Lane 2020-01-14 10:55:49 -08:00
parent 0d3cff0dde
commit 9bb1a0916e
2 changed files with 3 additions and 5 deletions

View File

@ -1044,11 +1044,9 @@ def get_commit_details(commit, revision=None):
datetime = sig.get_time()
# XXX What do we do with timezone?
_timezone = sig.get_time_zone()
timeval = GLib.TimeVal()
ok = datetime.to_timeval(timeval)
if not ok:
time_str = datetime.format_iso8601()
if not time_str:
raise CommitTimeValError
time_str = timeval.to_iso8601()
return CommitDetails(commit_str, time_str, message, revision)

View File

@ -681,7 +681,7 @@ hostname = "testing-bad-recipe"
def test_03_list_commits_commit_time_val_error(self):
"""Test listing recipe commits which raise CommitTimeValError"""
with mock.patch('pylorax.api.recipes.GLib.DateTime.to_timeval', return_value=False):
with mock.patch('pylorax.api.recipes.GLib.DateTime.format_iso8601', return_value=False):
commits = recipes.list_commits(self.repo, "master", "test-recipe.toml")
self.assertEqual(len(commits), 0, "Wrong number of commits.")