Skip to content

Commit

Permalink
#93: Test dictionary include
Browse files Browse the repository at this point in the history
  • Loading branch information
keiranjprice101 committed Oct 23, 2019
1 parent 1f55522 commit 22b1838
Showing 1 changed file with 53 additions and 1 deletion.
54 changes: 53 additions & 1 deletion test/test_entityHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def test_to_nested_dict(self):
"COMPLETE": None,
"DESCRIPTION": None,
"DOI": None,
"END_DATE":None,
"END_DATE": None,
"LOCATION": None,
"NAME": None,
"STARTDATE": None,
Expand All @@ -85,6 +85,58 @@ def test_to_nested_dict(self):
}
}
self.assertEqual(expected_dict, self.datafile.to_nested_dict("DATASET"))
expected_dict = {
"ID": 1,
"LOCATION": "test location",
"NAME": "test name",
"MOD_TIME": str(datetime.datetime(2000, 1, 1)),
"CHECKSUM": "test checksum",
"FILESIZE": 64,
"DATAFILEMODTIME": str(datetime.datetime(2000, 1, 1)),
"DATAFILECREATETIME": str(datetime.datetime(2000, 1, 1)),
"DATASET_ID": 1,
"DOI": "test doi",
"DESCRIPTION": "test description",
"CREATE_ID": "test create id",
"MOD_ID": "test mod id",
"DATAFILEFORMAT_ID": 1,
"CREATE_TIME": str(datetime.datetime(2000, 1, 1)),
"DATASET": {
"ID": None,
"CREATE_TIME": None,
"MOD_TIME": None,
"CREATE_ID": None,
"MOD_ID": None,
"INVESTIGATION_ID": None,
"COMPLETE": None,
"DESCRIPTION": None,
"DOI": None,
"END_DATE": None,
"LOCATION": None,
"NAME": None,
"STARTDATE": None,
"SAMPLE_ID": None,
"TYPE_ID": None,
"INVESTIGATION": {
"ID": None,
"CREATE_ID": None,
"CREATE_TIME": None,
"DOI": None,
"ENDDATE": None,
"MOD_ID": None,
"MOD_TIME": None,
"NAME": None,
"RELEASEDATE": None,
"STARTDATE": None,
"SUMMARY": None,
"TITLE": None,
"VISIT_ID": None,
"FACILITY_ID": None,
"TYPE_ID": None
}
}
}
self.assertEqual(expected_dict, self.datafile.to_nested_dict({"DATASET": "INVESTIGATION"}))

def test_get_related_entity(self):
self.assertEqual(self.dataset, self.datafile.get_related_entity("DATASET"))
Expand Down

0 comments on commit 22b1838

Please sign in to comment.