|
@@ 579-594 (lines=16) @@
|
| 576 |
|
# set submission |
| 577 |
|
self.submission = self.sample.submission |
| 578 |
|
|
| 579 |
|
def test_to_biosample(self): |
| 580 |
|
"""Testing JSON conversion for biosample submission""" |
| 581 |
|
|
| 582 |
|
base_dir = os.path.dirname(os.path.abspath(__file__)) |
| 583 |
|
file_path = os.path.join(base_dir, "biosample_sample.json") |
| 584 |
|
handle = open(file_path) |
| 585 |
|
reference = json.load(handle) |
| 586 |
|
|
| 587 |
|
# fix release date to today |
| 588 |
|
now = timezone.now() |
| 589 |
|
reference['releaseDate'] = str(now.date()) |
| 590 |
|
|
| 591 |
|
test = self.sample.to_biosample() |
| 592 |
|
|
| 593 |
|
self.maxDiff = None |
| 594 |
|
self.assertEqual(reference, test) |
| 595 |
|
|
| 596 |
|
def test_to_biosample2(self): |
| 597 |
|
"""testing json conversion with a biosample_id""" |
|
@@ 396-411 (lines=16) @@
|
| 393 |
|
self.animal = Animal.objects.get(pk=1) |
| 394 |
|
self.submission = self.animal.submission |
| 395 |
|
|
| 396 |
|
def test_to_biosample(self): |
| 397 |
|
"""Testing JSON conversion for biosample submission""" |
| 398 |
|
|
| 399 |
|
base_dir = os.path.dirname(os.path.abspath(__file__)) |
| 400 |
|
file_path = os.path.join(base_dir, "biosample_animal.json") |
| 401 |
|
handle = open(file_path) |
| 402 |
|
reference = json.load(handle) |
| 403 |
|
|
| 404 |
|
# fix release date to today |
| 405 |
|
now = timezone.now() |
| 406 |
|
reference['releaseDate'] = str(now.date()) |
| 407 |
|
|
| 408 |
|
test = self.animal.to_biosample() |
| 409 |
|
|
| 410 |
|
self.maxDiff = None |
| 411 |
|
self.assertEqual(reference, test) |
| 412 |
|
|
| 413 |
|
def test_to_biosample2(self): |
| 414 |
|
"""testing json conversion with a biosample_id""" |