@@ -85,3 +85,36 @@ def test_get_thalemine_publications(self):
8585 response = self .app_client .get ("/thalemine/publications/At1g0101x" )
8686 expected = {"wasSuccessful" : False , "error" : "Invalid gene id" }
8787 self .assertEqual (response .json , expected )
88+
89+ def test_get_thalemine_gene_information (self ):
90+ """This tests the data returned by the ThaleMine gene information endpoint
91+ :return:
92+ """
93+ # Valid data
94+ response = self .app_client .get ("/thalemine/gene_information/At1g01010" )
95+
96+ # Delete query time data. It will always be different
97+ response = response .json
98+ response .pop ("executionTime" )
99+
100+ # Note: pytest is running from project root. So path is relative to project root
101+ # Also, delete execution time from output before saving.
102+ with open ("tests/data/get_thalemine_gene_information_1.json" ) as json_file :
103+ expected = load (json_file )
104+ self .assertEqual (response , expected )
105+
106+ # Valid but does not exists
107+ response = self .app_client .get ("/thalemine/gene_information/At1g01011" )
108+
109+ # Again, delete time data.
110+ response = response .json
111+ response .pop ("executionTime" )
112+
113+ with open ("tests/data/get_thalemine_gene_information_2.json" ) as json_file :
114+ expected = load (json_file )
115+ self .assertEqual (response , expected )
116+
117+ # Invalid gene id
118+ response = self .app_client .get ("/thalemine/gene_information/At1g0101x" )
119+ expected = {"wasSuccessful" : False , "error" : "Invalid gene id" }
120+ self .assertEqual (response .json , expected )
0 commit comments