|
@@ 504-519 (lines=16) @@
|
| 501 |
|
# set submission |
| 502 |
|
self.submission = self.sample.submission |
| 503 |
|
|
| 504 |
|
def test_to_biosample(self): |
| 505 |
|
"""Testing JSON conversion for biosample submission""" |
| 506 |
|
|
| 507 |
|
base_dir = os.path.dirname(os.path.abspath(__file__)) |
| 508 |
|
file_path = os.path.join(base_dir, "biosample_sample.json") |
| 509 |
|
handle = open(file_path) |
| 510 |
|
reference = json.load(handle) |
| 511 |
|
|
| 512 |
|
# fix release date to today |
| 513 |
|
now = timezone.now() |
| 514 |
|
reference['releaseDate'] = str(now.date()) |
| 515 |
|
|
| 516 |
|
test = self.sample.to_biosample() |
| 517 |
|
|
| 518 |
|
self.maxDiff = None |
| 519 |
|
self.assertEqual(reference, test) |
| 520 |
|
|
| 521 |
|
def test_to_biosample2(self): |
| 522 |
|
"""testing json conversion with a biosample_id""" |
|
@@ 317-332 (lines=16) @@
|
| 314 |
|
self.animal = Animal.objects.get(pk=1) |
| 315 |
|
self.submission = self.animal.submission |
| 316 |
|
|
| 317 |
|
def test_to_biosample(self): |
| 318 |
|
"""Testing JSON conversion for biosample submission""" |
| 319 |
|
|
| 320 |
|
base_dir = os.path.dirname(os.path.abspath(__file__)) |
| 321 |
|
file_path = os.path.join(base_dir, "biosample_animal.json") |
| 322 |
|
handle = open(file_path) |
| 323 |
|
reference = json.load(handle) |
| 324 |
|
|
| 325 |
|
# fix release date to today |
| 326 |
|
now = timezone.now() |
| 327 |
|
reference['releaseDate'] = str(now.date()) |
| 328 |
|
|
| 329 |
|
test = self.animal.to_biosample() |
| 330 |
|
|
| 331 |
|
self.maxDiff = None |
| 332 |
|
self.assertEqual(reference, test) |
| 333 |
|
|
| 334 |
|
def test_to_biosample2(self): |
| 335 |
|
"""testing json conversion with a biosample_id""" |