|
@@ 551-566 (lines=16) @@
|
| 548 |
|
# set submission |
| 549 |
|
self.submission = self.sample.submission |
| 550 |
|
|
| 551 |
|
def test_to_biosample(self): |
| 552 |
|
"""Testing JSON conversion for biosample submission""" |
| 553 |
|
|
| 554 |
|
base_dir = os.path.dirname(os.path.abspath(__file__)) |
| 555 |
|
file_path = os.path.join(base_dir, "biosample_sample.json") |
| 556 |
|
handle = open(file_path) |
| 557 |
|
reference = json.load(handle) |
| 558 |
|
|
| 559 |
|
# fix release date to today |
| 560 |
|
now = timezone.now() |
| 561 |
|
reference['releaseDate'] = str(now.date()) |
| 562 |
|
|
| 563 |
|
test = self.sample.to_biosample() |
| 564 |
|
|
| 565 |
|
self.maxDiff = None |
| 566 |
|
self.assertEqual(reference, test) |
| 567 |
|
|
| 568 |
|
def test_to_biosample2(self): |
| 569 |
|
"""testing json conversion with a biosample_id""" |
|
@@ 365-380 (lines=16) @@
|
| 362 |
|
self.animal = Animal.objects.get(pk=1) |
| 363 |
|
self.submission = self.animal.submission |
| 364 |
|
|
| 365 |
|
def test_to_biosample(self): |
| 366 |
|
"""Testing JSON conversion for biosample submission""" |
| 367 |
|
|
| 368 |
|
base_dir = os.path.dirname(os.path.abspath(__file__)) |
| 369 |
|
file_path = os.path.join(base_dir, "biosample_animal.json") |
| 370 |
|
handle = open(file_path) |
| 371 |
|
reference = json.load(handle) |
| 372 |
|
|
| 373 |
|
# fix release date to today |
| 374 |
|
now = timezone.now() |
| 375 |
|
reference['releaseDate'] = str(now.date()) |
| 376 |
|
|
| 377 |
|
test = self.animal.to_biosample() |
| 378 |
|
|
| 379 |
|
self.maxDiff = None |
| 380 |
|
self.assertEqual(reference, test) |
| 381 |
|
|
| 382 |
|
def test_to_biosample2(self): |
| 383 |
|
"""testing json conversion with a biosample_id""" |