|
@@ 296-311 (lines=16) @@
|
| 293 |
|
self.animal = Animal.objects.get(pk=1) |
| 294 |
|
self.submission = self.animal.submission |
| 295 |
|
|
| 296 |
|
def test_to_biosample(self): |
| 297 |
|
"""Testing JSON conversion for biosample submission""" |
| 298 |
|
|
| 299 |
|
base_dir = os.path.dirname(os.path.abspath(__file__)) |
| 300 |
|
file_path = os.path.join(base_dir, "biosample_animal.json") |
| 301 |
|
handle = open(file_path) |
| 302 |
|
reference = json.load(handle) |
| 303 |
|
|
| 304 |
|
# fix release date to today |
| 305 |
|
now = timezone.now() |
| 306 |
|
reference['releaseDate'] = str(now.date()) |
| 307 |
|
|
| 308 |
|
test = self.animal.to_biosample() |
| 309 |
|
|
| 310 |
|
self.maxDiff = None |
| 311 |
|
self.assertEqual(reference, test) |
| 312 |
|
|
| 313 |
|
def test_to_biosample2(self): |
| 314 |
|
"""testing json conversion with a biosample_id""" |
|
@@ 483-498 (lines=16) @@
|
| 480 |
|
# set submission |
| 481 |
|
self.submission = self.sample.submission |
| 482 |
|
|
| 483 |
|
def test_to_biosample(self): |
| 484 |
|
"""Testing JSON conversion for biosample submission""" |
| 485 |
|
|
| 486 |
|
base_dir = os.path.dirname(os.path.abspath(__file__)) |
| 487 |
|
file_path = os.path.join(base_dir, "biosample_sample.json") |
| 488 |
|
handle = open(file_path) |
| 489 |
|
reference = json.load(handle) |
| 490 |
|
|
| 491 |
|
# fix release date to today |
| 492 |
|
now = timezone.now() |
| 493 |
|
reference['releaseDate'] = str(now.date()) |
| 494 |
|
|
| 495 |
|
test = self.sample.to_biosample() |
| 496 |
|
|
| 497 |
|
self.maxDiff = None |
| 498 |
|
self.assertEqual(reference, test) |
| 499 |
|
|
| 500 |
|
def test_to_biosample2(self): |
| 501 |
|
"""testing json conversion with a biosample_id""" |