def setUp(self): # don't do the base setUp (it would interfere w/ the ids of the ontology created below) # super(TestQOntolgoy, self).setUp() self.test_project = create_project( name="project", title="Project", email="*****@*****.**", description="A test project to use while testing recursions", ) self.test_categorization = create_categorization( filename="categorization.xml", name="categorization", version="2.0", ) self.test_ontology_schema = create_ontology( filename="ontology_schema.xml", name="ontology", version="2.0", ) self.test_ontology_schema.categorization = self.test_categorization self.test_ontology_schema.save() # TODO: SEE THE COMMENT IN "q_fields.py" ABOUT SETTING VERSION MANUALLY... self.test_ontology_schema.refresh_from_db() self.test_categorization.refresh_from_db() self.test_ontology_schema.register() self.test_categorization.register()
def test_ontology_validity(self): invalid_ontology = create_ontology( filename=TEST_ONTOLOGY_INVALID, name="test_invalid_schema", version="2", ) with self.assertRaises(ValidationError): invalid_ontology.full_clean()
def setUp(self): super(TestQOntolgoy, self).setUp() # create a test ontology self.test_ontology = create_ontology( name="test_ontology", version="1.0", )
def test_ontology_unique_name(self): with self.assertRaises(IntegrityError): invalid_ontology = create_ontology( filename=TEST_SCHEMA_VALID, name=self.test_ontology_schema.name, version="2", type=QOntologyTypes.SCHEMA.get_type(), ) invalid_ontology.full_clean()
def setUp(self): super(TestQCategorization, self).setUp() # create a test categorization # (this requires a test ontology) self.test_categorization = create_categorization() self.test_ontology = create_ontology() self.test_ontology.categorization = self.test_categorization self.test_ontology.save()
def setUp(self): # don't do the base setUp (it would interfere w/ the ids of the proxies registered below) # super(TestQOntolgoy, self).setUp() # create some test ontologies... self.test_ontology_schema = create_ontology( filename=TEST_SCHEMA_VALID, name="test_schema", version="2", type=QOntologyTypes.SCHEMA.get_type(), ) # TODO: SEE THE COMMENT IN "q_fields.py" ABOUT SETTING VERSION MANUALLY... self.test_ontology_schema.refresh_from_db()
def setUp(self): # don't do the base setUp (it would interfere w/ the ids of the ontology created below) # super(TestQOntolgoy, self).setUp() # create some test categorizations... self.test_categorization = create_categorization( filename="categorization.xml", name="test_cat", # the categorization from the fixture is called "test_categorization", so I can't use that same name here version="1.0", ) # create some test ontologies... self.test_ontology_schema = create_ontology( filename="ontology_schema.xml", name="test_ontology_schema", version="2.0", ) self.test_ontology_schema.categorization = self.test_categorization self.test_ontology_schema.save() # TODO: SEE THE COMMENT IN "q_fields.py" ABOUT SETTING VERSION MANUALLY... self.test_categorization.refresh_from_db() self.test_ontology_schema.refresh_from_db()