def testTagsRoute(self): """Tests that the /tags route offers the correct run to tag mapping.""" response = self.server.get("/data/plugin/mesh/tags") self.assertEqual(200, response.status_code) tags = test_utils.deserialize_json_response(response.get_data()) self.assertIn(self.runs[0], tags) for name in self.names: self.assertIn(name, tags[self.runs[0]])
def testsEventsAlwaysSortedByStep(self): """Tests that events always sorted by step.""" response = self.server.get( "/data/plugin/mesh/meshes?run=%s&tag=%s&sample=%d" % (self.runs[0], self.names[1], 0)) self.assertEqual(200, response.status_code) metadata = test_utils.deserialize_json_response(response.get_data()) for i in range(1, self.steps): # Step will be equal when two tensors of different content type # belong to the same mesh. self.assertLessEqual(metadata[i - 1]["step"], metadata[i]["step"])
def testMetadataRoute(self): """Tests that the /meshes route returns correct metadata for meshes.""" response = self.server.get( "/data/plugin/mesh/meshes?run=%s&tag=%s&sample=%d" % (self.runs[0], self.names[0], 0)) self.assertEqual(200, response.status_code) metadata = test_utils.deserialize_json_response(response.get_data()) self.assertEqual(len(metadata), self.steps) self.assertAllEqual(metadata[0]["content_type"], plugin_data_pb2.MeshPluginData.VERTEX) self.assertAllEqual(metadata[0]["data_shape"], self.data[0].vertices.shape)