1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-12-08 03:14:47 +01:00

Fix osc.gitea_api.dt_sanitize() by replacing dateutil with datetime

This commit is contained in:
2025-07-28 17:25:14 +02:00
parent 2529014c78
commit 9049e4164f
2 changed files with 49 additions and 8 deletions

View File

@@ -0,0 +1,25 @@
import unittest
from osc.gitea_api import dt_sanitize
class TestGiteaApiCommon(unittest.TestCase):
def test_dt_sanitize(self):
datetime_str = "1970-01-01T01:00:00+01:00"
expected = "1970-01-01 00:00"
actual = dt_sanitize(datetime_str)
self.assertEqual(expected, actual)
datetime_str = "1970-01-01T01:00:00-01:00"
expected = "1970-01-01 02:00"
actual = dt_sanitize(datetime_str)
self.assertEqual(expected, actual)
datetime_str = "1970-01-01T00:00:00Z"
expected = "1970-01-01 00:00"
actual = dt_sanitize(datetime_str)
self.assertEqual(expected, actual)
if __name__ == "__main__":
unittest.main()