def should_set_session_datatype(self):
        xnatSubject = subject_mock("1", "PROJECT_NAME")

        s = import_subject(self.dsc, xnatSubject)

        for exp in s.getExperiments():
            self.assertNotNone(exp.getOwnerProperty(DATATYPE_PROPERTY))
    def should_set_session_datatype(self):
        xnatSubject = subject_mock("1", "PROJECT_NAME")

        s = import_subject(self.dsc, xnatSubject)

        for exp in s.getExperiments():
            self.assertNotNone(exp.getOwnerProperty(DATATYPE_PROPERTY))
    def should_import_session_from_subject_as_experiments(self):
        xnatSubject = subject_mock("1", "PROJECT_NAME")

        ctx = self.dsc.getContext()
        project = ctx.insertProject("session_import", "session_import", api.datetime())
        s = import_subject(self.dsc, xnatSubject, project=project)

        # Assertions
        self.assertGreaterEqual(len(xnatSubject.experiments().get()), 1)
        self.assertEqual(len(project.getExperiments()), len(xnatSubject.experiments().get()))
    def should_import_attrs(self):

        projectName = 'PROJECT_NAME'
        xnatSubject = subject_mock('1', projectName)
        subject = import_subject(self.dsc, xnatSubject)

        attributes = xnat_api(xnatSubject.attrs)
        attrs = xnatSubject.attrs
        for attr in attributes:
            if is_atomic_attribute(attrs(), attrs):
                value = xnat_api(attrs.get, attr)
                eq_(subject.getOwnerProperty(attr), value)
    def should_import_session_from_subject_as_experiments(self):
        xnatSubject = subject_mock("1", "PROJECT_NAME")

        ctx = self.dsc.getContext()
        project = ctx.insertProject('session_import', 'session_import',
                                    api.datetime())
        s = import_subject(self.dsc, xnatSubject, project=project)

        # Assertions
        self.assertGreaterEqual(len(xnatSubject.experiments().get()), 1)
        self.assertEqual(len(project.getExperiments()),
                         len(xnatSubject.experiments().get()))
    def should_import_attrs(self):

        projectName = 'PROJECT_NAME'
        xnatSubject = subject_mock('1', projectName)
        subject = import_subject(self.dsc, xnatSubject)

        attributes = xnat_api(xnatSubject.attrs)
        attrs = xnatSubject.attrs
        for attr in attributes:
            if is_atomic_attribute(attrs(), attrs):
                value = xnat_api(attrs.get, attr)
                eq_(subject.getOwnerProperty(attr), value)