diff options
author | 2012-06-16 13:10:32 +0200 | |
---|---|---|
committer | 2012-06-16 13:10:32 +0200 | |
commit | 5cd7ad5f4898b538f771290548ba131f7063d94c (patch) | |
tree | 4636f091e5018bee6b32c9e6de2688a48e5d6ca0 /pygithub3/tests/services/test_core.py | |
parent | Remove list_milestones from repo service (diff) | |
download | python-github3-5cd7ad5f4898b538f771290548ba131f7063d94c.tar.xz python-github3-5cd7ad5f4898b538f771290548ba131f7063d94c.zip |
Refact normalize of dates into base.Service
Diffstat (limited to 'pygithub3/tests/services/test_core.py')
-rw-r--r-- | pygithub3/tests/services/test_core.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/pygithub3/tests/services/test_core.py b/pygithub3/tests/services/test_core.py index 8a2bbbe..556f3d9 100644 --- a/pygithub3/tests/services/test_core.py +++ b/pygithub3/tests/services/test_core.py @@ -1,8 +1,9 @@ #!/usr/bin/env python # -*- encoding: utf-8 -*- -import requests +from datetime import datetime +import requests from mock import patch from pygithub3.tests.utils.core import TestCase @@ -54,6 +55,16 @@ class TestServiceCalls(TestCase): self.assertFalse(request_method.called) self.assertIsInstance(result, base.Result) + def test_normalize_ok(self, request_method): + data = {'test': datetime(2012, 12, 12, 3, 3, 3)} + self.s._normalize_date('test', data) + self.assertEqual(data['test'], '2012-12-12T03:03:03Z') + + def test_normalize_fail(self, request_method): + data = {'test': 'fail'} + self.s._normalize_date('test', data) + self.assertEqual(data['test'], 'fail') + @patch.object(requests.sessions.Session, 'request') class TestMimeType(TestCase): |