incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [6/34] git commit: [#4785] ticket:163 fix test
Date Tue, 02 Oct 2012 21:30:28 GMT
[#4785] ticket:163 fix test


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/473db38f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/473db38f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/473db38f

Branch: refs/heads/db/4968
Commit: 473db38f4e28889e08dcc2450d8607de79158185
Parents: 96f64bd
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Fri Sep 7 17:48:45 2012 +0300
Committer: Cory Johns <johnsca@geek.net>
Committed: Tue Oct 2 15:12:32 2012 +0000

----------------------------------------------------------------------
 ForgeShortUrl/forgeshorturl/tests/test_commands.py |   21 +++------------
 1 files changed, 4 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/473db38f/ForgeShortUrl/forgeshorturl/tests/test_commands.py
----------------------------------------------------------------------
diff --git a/ForgeShortUrl/forgeshorturl/tests/test_commands.py b/ForgeShortUrl/forgeshorturl/tests/test_commands.py
index fe1313d..874d2ff 100644
--- a/ForgeShortUrl/forgeshorturl/tests/test_commands.py
+++ b/ForgeShortUrl/forgeshorturl/tests/test_commands.py
@@ -3,11 +3,8 @@ from forgeshorturl.command import migrate_urls
 from forgeshorturl.model import ShortUrl
 from allura import model as M
 from mock import patch, MagicMock, Mock
-import datetime
-import time
 
 test_config = 'test.ini#main'
-fmt = '%Y-%m-%d %H:%M'
 
 
 def setUp(self):
@@ -18,10 +15,6 @@ def setUp(self):
 
 class TableMock(MagicMock):
 
-    def _make_timestamp(self, date):
-        d = datetime.datetime.strptime(date, fmt)
-        return time.mktime(d.timetuple())
-
     def select(self):
         m = Mock()
         m.execute = self.execute
@@ -34,8 +27,8 @@ class TableMock(MagicMock):
                 'url': 'http://google.com',
                 'description': 'Two\nlines',
                 'private': 'N',
-                'create_time': self._make_timestamp('2012-09-01 10:00'),
-                'edit_time': self._make_timestamp('2012-09-01 12:30'),
+                'create_time': 1,
+                'edit_time': 2,
                 'create_user': 1
             },
             {
@@ -43,8 +36,8 @@ class TableMock(MagicMock):
                 'url': 'http://yahoo.com',
                 'description': 'One line',
                 'private': 'Y',
-                'create_time': self._make_timestamp('2012-09-02 10:00'),
-                'edit_time': self._make_timestamp('2012-09-02 12:30'),
+                'create_time': 3,
+                'edit_time': 4,
                 'create_user': 1
             }
         ]
@@ -65,16 +58,10 @@ def test_migrate_urls():
     assert u.url == 'http://google.com'
     assert u.description == 'Two\nlines'
     assert not u.private
-    assert u.created == datetime.datetime.strptime('2012-09-01 10:00', fmt)
-    assert u.last_updated == (datetime.datetime
-                                      .strptime('2012-09-01 12:30', fmt))
     assert u.create_user == M.User.anonymous()._id
 
     u = ShortUrl.query.get(short_name='y')
     assert u.url == 'http://yahoo.com'
     assert u.description == 'One line'
     assert u.private
-    assert u.created == datetime.datetime.strptime('2012-09-02 10:00', fmt)
-    assert u.last_updated == (datetime.datetime
-                                      .strptime('2012-09-02 12:30', fmt))
     assert u.create_user == M.User.anonymous()._id


Mime
View raw message