def test_launch_EEG(self): """ Check that all required keys are present in output from EegSensorViewer launch. """ ## Import Sensors zip_path = os.path.join(os.path.dirname(tvb_data.sensors.__file__), 'eeg_unitvector_62.txt.bz2') TestFactory.import_sensors(self.test_user, self.test_project, zip_path, Sensors_Importer.EEG_SENSORS) sensors = TestFactory.get_entity(self.test_project, SensorsEEG()) ## Import EEGCap cap_path = os.path.join(os.path.dirname(tvb_data.obj.__file__), 'eeg_cap.obj') TestFactory.import_surface_obj(self.test_user, self.test_project, cap_path, EEG_CAP) eeg_cap_surface = TestFactory.get_entity(self.test_project, EEGCap()) viewer = SensorsViewer() viewer.current_project_id = self.test_project.id ## Launch with EEG Cap selected result = viewer.launch(sensors, eeg_cap_surface) self.assert_compliant_dictionary(self.EXPECTED_KEYS_EEG, result) for key in ['urlVertices', 'urlTriangles', 'urlLines', 'urlNormals']: self.assertIsNotNone(result[key], "Value at key %s should not be None" % key) ## Launch without EEG Cap result = viewer.launch(sensors) self.assert_compliant_dictionary(self.EXPECTED_KEYS_EEG, result) for key in ['urlVertices', 'urlTriangles', 'urlLines', 'urlNormals']: self.assertTrue(not result[key] or result[key] == "[]", "Value at key %s should be None or empty, but is %s" % (key, result[key]))
def setUp(self): """ Sets up the environment for running the tests; creates a test user, a test project, a connectivity and a surface; imports a CFF data-set """ self.datatypeFactory = DatatypesFactory() self.test_project = self.datatypeFactory.get_project() self.test_user = self.datatypeFactory.get_user() ## Import Shelf Face Object face_path = os.path.join(os.path.dirname(tvb_data.obj.__file__), 'face_surface.obj') TestFactory.import_surface_obj(self.test_user, self.test_project, face_path, FACE)
def setUp(self): """ Sets up the environment for running the tests; creates a test user, a test project, a connectivity and a surface; imports a CFF data-set """ self.datatypeFactory = DatatypesFactory() self.test_project = self.datatypeFactory.get_project() self.test_user = self.datatypeFactory.get_user() ## Import Shelf Face Object face_path = os.path.join(os.path.dirname(tvb_data.obj.__file__), 'face_surface.obj') TestFactory.import_surface_obj(self.test_user, self.test_project, face_path, FACE)
def test_launch_EEG(self): """ Check that all required keys are present in output from EegSensorViewer launch. """ ## Import Sensors zip_path = os.path.join(os.path.dirname(tvb_data.sensors.__file__), 'EEG_unit_vectors_BrainProducts_62.txt.bz2') TestFactory.import_sensors(self.test_user, self.test_project, zip_path, Sensors_Importer.EEG_SENSORS) sensors = TestFactory.get_entity(self.test_project, SensorsEEG()) ## Import EEGCap cap_path = os.path.join(os.path.dirname(tvb_data.obj.__file__), 'eeg_cap.obj') TestFactory.import_surface_obj(self.test_user, self.test_project, cap_path, EEG_CAP) eeg_cap_surface = TestFactory.get_entity(self.test_project, EEGCap()) viewer = SensorsViewer() viewer.current_project_id = self.test_project.id ## Launch with EEG Cap selected result = viewer.launch(sensors, eeg_cap_surface) self.assert_compliant_dictionary(self.EXPECTED_KEYS_EEG, result) for key in ['urlVertices', 'urlTriangles', 'urlLines', 'urlNormals']: self.assertIsNotNone(result[key], "Value at key %s should not be None" % key) ## Launch without EEG Cap result = viewer.launch(sensors) self.assert_compliant_dictionary(self.EXPECTED_KEYS_EEG, result) for key in ['urlVertices', 'urlTriangles', 'urlLines', 'urlNormals']: self.assertTrue( not result[key] or result[key] == "[]", "Value at key %s should be None or empty, but is %s" % (key, result[key]))