예제 #1
0
 def setUp(self):
     u = User(username="******")
     u.save()
     d = Data()
     d.save()
     self.sylva_graph = Graph(name="mygraph", data=d, owner=u)
     self.sylva_graph.save()
예제 #2
0
class InstanceRexsterTestSuite(TestCase):
    def setUp(self):
        self.u = User(username="******")
        self.u.save()
        d = Data()
        d.save()
        self.sylva_graph = Graph(name="mygraph", data=d, owner=self.u)
        self.sylva_graph.save()
        self.instanceName = "instanceRexster"
        self.instanceEngine = "engines.gdb.backends.rexster"
        self.instancePort = "7474"
        self.instancePath = "db/data"

    def test_instance_creation_rexster(self):
        """
        Tests that a rexster instance is created.
        """
        instance = Instance(name=self.instanceName, engine=self.instanceEngine, port=self.instancePort, path=self.instancePath, owner=self.u)
        instance.save()
        self.assertIsNotNone(instance)

    def test_instance_edition_rexster(self):
        """
        Tests that a rexster instance is edited.
        """
        instance = Instance(name=self.instanceName, engine=self.instanceEngine, port=self.instancePort, path=self.instancePath, owner=self.u)
        instance.save()
        self.assertIsNotNone(instance)
        self.assertEqual(instance.name, self.instanceName)
        instance.name = "instanceRexsterSet"
        self.assertEqual(instance.name, "instanceRexsterSet")

    def test_instance_gdb_rexster(self):
        """
        Tests that a rexster instance has a graph database (TODO).
        """
        instance = Instance(name=self.instanceName, engine=self.instanceEngine, port="7373", path="db/sylva", owner=self.u)
        instance.save()
        self.assertIsNotNone(instance)
        self.assertIsNotNone(self.sylva_graph)
        # gdb = instance.get_gdb(self.sylva_graph)
        # self.assertIsNotNone(gdb)

    def test_instance_deletion_rexster(self):
        """
        Tests that a rexster instance is deleted.
        """
        instance = Instance(name=self.instanceName, engine=self.instanceEngine, port=self.instancePort, path=self.instancePath, owner=self.u)
        instance.save()
        self.assertIsNotNone(instance)
        instance_id = instance.id
        Instance.objects.get(pk=instance_id).delete()
        try:
            Instance.objects.get(pk=instance_id)
            exists = True
        except Instance.DoesNotExist:
            exists = False
        self.assertEqual(exists, False)
예제 #3
0
 def setUp(self):
     self.u = User(username="******")
     self.u.save()
     d = Data()
     d.save()
     self.sylva_graph = Graph(name="mygraph", data=d, owner=self.u)
     self.sylva_graph.save()
     self.instanceName = "instanceRexster"
     self.instanceEngine = "engines.gdb.backends.rexster"
     self.instancePort = "7474"
     self.instancePath = "db/data"
예제 #4
0
class InstanceNeo4jTestSuite(TestCase):
    def setUp(self):
        self.u = User(username="******")
        self.u.save()
        d = Data()
        d.save()
        self.sylva_graph = Graph(name="mygraph", data=d, owner=self.u)
        self.sylva_graph.save()
        self.instanceName = "instanceNeo4j"
        self.instanceEngine = "engines.gdb.backends.neo4j"
        self.instancePort = "7474"
        self.instancePath = "db/data"

    def test_instance_creation_neo4j(self):
        """
        Tests that a neo4j instance is created.
        """
        instance = Instance(name=self.instanceName,
                            engine=self.instanceEngine,
                            port=self.instancePort,
                            path=self.instancePath,
                            owner=self.u)
        instance.save()
        self.assertIsNotNone(instance)

    def test_instance_edition_neo4j(self):
        """
        Tests that a neo4j instance is edited.
        """
        instance = Instance(name=self.instanceName,
                            engine=self.instanceEngine,
                            port=self.instancePort,
                            path=self.instancePath,
                            owner=self.u)
        instance.save()
        self.assertIsNotNone(instance)
        self.assertEqual(instance.name, self.instanceName)
        instance.name = "instanceNeo4jSet"
        self.assertEqual(instance.name, "instanceNeo4jSet")

    def test_instance_gdb_neo4j(self):
        """
        Tests that a neo4j instance has a graph database.
        """
        port = settings.GRAPHDATABASES["default"]["PORT"]
        path = settings.GRAPHDATABASES["default"]["NAME"]
        instance = Instance(name=self.instanceName,
                            engine=self.instanceEngine,
                            port=port,
                            path=path,
                            owner=self.u)
        instance.save()
        self.assertIsNotNone(instance)
        self.assertIsNotNone(self.sylva_graph)
        gdb = instance.get_gdb(self.sylva_graph)
        self.assertIsNotNone(gdb)

    def test_instance_deletion_neo4j(self):
        """
        Tests that a neo4j instance is deleted.
        """
        instance = Instance(name=self.instanceName,
                            engine=self.instanceEngine,
                            port=self.instancePort,
                            path=self.instancePath,
                            owner=self.u)
        instance.save()
        self.assertIsNotNone(instance)
        instance_id = instance.id
        Instance.objects.get(pk=instance_id).delete()
        try:
            Instance.objects.get(pk=instance_id)
            exists = True
        except Instance.DoesNotExist:
            exists = False
        self.assertEqual(exists, False)
예제 #5
0
파일: tests.py 프로젝트: CulturePlex/Sylva
class InstanceNeo4jTestSuite(TestCase):
    def setUp(self):
        self.u = User(username="******")
        self.u.save()
        d = Data()
        d.save()
        self.sylva_graph = Graph(name="mygraph", data=d, owner=self.u)
        self.sylva_graph.save()
        self.instanceName = "instanceNeo4j"
        self.instanceEngine = "engines.gdb.backends.neo4j"
        self.instancePort = "7474"
        self.instancePath = "db/data"

    def test_instance_creation_neo4j(self):
        """
        Tests that a neo4j instance is created.
        """
        instance = Instance(name=self.instanceName, engine=self.instanceEngine,
                            port=self.instancePort, path=self.instancePath,
                            owner=self.u)
        instance.save()
        self.assertIsNotNone(instance)

    def test_instance_edition_neo4j(self):
        """
        Tests that a neo4j instance is edited.
        """
        instance = Instance(name=self.instanceName, engine=self.instanceEngine,
                            port=self.instancePort, path=self.instancePath,
                            owner=self.u)
        instance.save()
        self.assertIsNotNone(instance)
        self.assertEqual(instance.name, self.instanceName)
        instance.name = "instanceNeo4jSet"
        self.assertEqual(instance.name, "instanceNeo4jSet")

    def test_instance_gdb_neo4j(self):
        """
        Tests that a neo4j instance has a graph database.
        """
        port = settings.GRAPHDATABASES["default"]["PORT"]
        path = settings.GRAPHDATABASES["default"]["NAME"]
        instance = Instance(name=self.instanceName, engine=self.instanceEngine,
                            port=port, path=path, owner=self.u)
        instance.save()
        self.assertIsNotNone(instance)
        self.assertIsNotNone(self.sylva_graph)
        gdb = instance.get_gdb(self.sylva_graph)
        self.assertIsNotNone(gdb)

    def test_instance_deletion_neo4j(self):
        """
        Tests that a neo4j instance is deleted.
        """
        instance = Instance(name=self.instanceName, engine=self.instanceEngine,
                            port=self.instancePort, path=self.instancePath,
                            owner=self.u)
        instance.save()
        self.assertIsNotNone(instance)
        instance_id = instance.id
        Instance.objects.get(pk=instance_id).delete()
        try:
            Instance.objects.get(pk=instance_id)
            exists = True
        except Instance.DoesNotExist:
            exists = False
        self.assertEqual(exists, False)