|
8 | 8 |
|
9 | 9 | from unittest import main |
10 | 10 | from types import GeneratorType |
| 11 | +import datetime |
11 | 12 |
|
12 | 13 | from labman.db.testing import LabmanTestCase |
13 | 14 | from labman.db.plate import PlateConfiguration, Plate |
@@ -184,6 +185,23 @@ def test_list_plates(self): |
184 | 185 | 'studies': ['Identification of the Microbiomes ' |
185 | 186 | 'for Cannabis Soils']}]) |
186 | 187 |
|
| 188 | + def test_plate_list_include_timestamp(self): |
| 189 | + # ...limit pathological failures by testing within an hour of creation |
| 190 | + exp = datetime.datetime.now() |
| 191 | + exp = datetime.datetime(exp.year, |
| 192 | + exp.month, |
| 193 | + exp.day, |
| 194 | + exp.hour) |
| 195 | + |
| 196 | + for i in Plate.list_plates(): |
| 197 | + obs = i['creation_timestamp'] |
| 198 | + obs = datetime.datetime(obs.year, |
| 199 | + obs.month, |
| 200 | + obs.day, |
| 201 | + obs.hour) |
| 202 | + |
| 203 | + self.assertEqual(obs, exp) |
| 204 | + |
187 | 205 | def test_plate_list_discarded_functionality(self): |
188 | 206 | # test case based on the test_list_plates |
189 | 207 | obs = Plate.list_plates() |
@@ -268,6 +286,15 @@ def test_create(self): |
268 | 286 | def test_properties(self): |
269 | 287 | # Plate 21 - Defined in the test DB |
270 | 288 | tester = Plate(21) |
| 289 | + |
| 290 | + obs = tester.creation_timestamp |
| 291 | + obs = datetime.datetime(obs.year, |
| 292 | + obs.month, |
| 293 | + obs.day, |
| 294 | + obs.hour) |
| 295 | + exp = datetime.datetime.now() |
| 296 | + exp = datetime.datetime(exp.year, exp.month, exp.day, exp.hour) |
| 297 | + self.assertEqual(obs, exp) |
271 | 298 | self.assertEqual(tester.external_id, 'Test plate 1') |
272 | 299 | self.assertEqual(tester.plate_configuration, PlateConfiguration(1)) |
273 | 300 | self.assertFalse(tester.discarded) |
|
0 commit comments