Skip to content

Commit 6601e24

Browse files
committed
fix test
1 parent b883817 commit 6601e24

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

qiita_db/test/test_user.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def setUp(self):
7676
'social_orcid': None,
7777
'social_researchgate': None,
7878
'social_googlescholar': None,
79-
'creation_timestamp': None
79+
'creation_timestamp': datetime(2015, 12, 3, 13, 52, 42, 751331)
8080
}
8181

8282
def tearDown(self):
@@ -265,8 +265,19 @@ def test_get_info(self):
265265
'social_orcid': None,
266266
'social_researchgate': None,
267267
'social_googlescholar': None,
268-
'creation_timestamp': None
268+
'creation_timestamp': datetime(2015, 12, 3, 13, 52, 42, 751331)
269269
}
270+
271+
# test database is re-populated during testing several times.
272+
# Creation_timestamp depends on the percise timing of the repopulation,
273+
# i.e. we cannot predict its value. We just test that this date should
274+
# be within an hour and now. For the remainder of tests, we update
275+
# our expectation.
276+
self.assertTrue(datetime.now() - timedelta(hours=1) <
277+
self.user.info['creation_timestamp'] <
278+
datetime.now())
279+
expinfo['creation_timestamp'] = self.user.info['creation_timestamp']
280+
270281
self.assertEqual(self.user.info, expinfo)
271282

272283
def test_set_info(self):

0 commit comments

Comments
 (0)