Exemplo n.º 1
0
    def test_drop_graph_by_object(self):
        graph_name = str(uuid.uuid1()).replace("-", "_")

        # Create graph and verify that it's in the get_graph_names() list
        graph = ta.Graph(name=graph_name)
        self.assertTrue(graph_name in ta.get_graph_names(), graph_name + " should exist in the list of graphs")

        # Drop graph using the graph object
        self.assertEqual(1, ta.drop_graphs(graph), "drop_graphs() should have deleted one graph.")
        self.assertFalse(graph_name in ta.get_graph_names(), graph_name + " should not exist in the list of graphs")
Exemplo n.º 2
0
    def test_graph_rename(self):
        graph_name = str(uuid.uuid1()).replace('-','_')
        new_graph_name = str(uuid.uuid1()).replace('-','_')

        # Create graph
        graph = ta.Graph(name=graph_name)
        graph.name = new_graph_name

        self.assertTrue(new_graph_name in ta.get_graph_names(), new_graph_name + " should be in list of graphs")
        self.assertFalse(graph_name in ta.get_graph_names(), graph_name + " should not be in list of graphs")
Exemplo n.º 3
0
    def test_graph_rename(self):
        graph_name = str(uuid.uuid1()).replace('-', '_')
        new_graph_name = str(uuid.uuid1()).replace('-', '_')

        # Create graph
        graph = ta.Graph(name=graph_name)
        graph.name = new_graph_name

        self.assertTrue(new_graph_name in ta.get_graph_names(),
                        new_graph_name + " should be in list of graphs")
        self.assertFalse(graph_name in ta.get_graph_names(),
                         graph_name + " should not be in list of graphs")
Exemplo n.º 4
0
    def test_generic_drop_by_name(self):
        # Create graph
        graph_name = str(uuid.uuid1()).replace("-", "_")
        graph = ta.Graph(name=graph_name)

        # Check that the graph we just created now exists
        self.assertTrue(graph_name in ta.get_graph_names(), graph_name + " should exist in the list of graph names")

        # drop item using graph name
        self.assertEqual(1, ta.drop(graph_name), "drop() should have deleted one item")

        # check that the graph no longer exists
        self.assertFalse(graph_name in ta.get_graph_names(), graph_name + " should not exist in the list of graph")
Exemplo n.º 5
0
    def test_drop_graph_by_object(self):
        graph_name = str(uuid.uuid1()).replace('-', '_')

        # Create graph and verify that it's in the get_graph_names() list
        graph = ta.Graph(name=graph_name)
        self.assertTrue(graph_name in ta.get_graph_names(),
                        graph_name + " should exist in the list of graphs")

        # Drop graph using the graph object
        self.assertEqual(1, ta.drop_graphs(graph),
                         "drop_graphs() should have deleted one graph.")
        self.assertFalse(
            graph_name in ta.get_graph_names(),
            graph_name + " should not exist in the list of graphs")
Exemplo n.º 6
0
    def test_generic_drop_by_object(self):
        # Create graph
        graph_name = str(uuid.uuid1()).replace('-', '_')
        graph = ta.Graph(name=graph_name)

        # Check that the graph we just created now exists
        self.assertTrue(
            graph_name in ta.get_graph_names(),
            graph_name + " should exist in the list of graph names")

        # drop item using graph object
        self.assertEqual(1, ta.drop(graph),
                         "drop() should have deleted one item")

        # check that the graph no longer exists
        self.assertFalse(graph_name in ta.get_graph_names(),
                         graph_name + " should not exist in the list of graph")
Exemplo n.º 7
0
    def test_drop_graph_that_does_not_exist(self):
        graph_name = str(uuid.uuid1()).replace('-', '_')

        self.assertFalse(
            graph_name in ta.get_graph_names(),
            graph_name + " should not exist in the list of graphs")

        self.assertEqual(0, ta.drop_graphs(graph_name),
                         "drop_graphs() shouldn't have deleted any graphs")
Exemplo n.º 8
0
    def test_create_kmeans_model_with_duplicte_graph_name(self):
        graph_name = str(uuid.uuid1()).replace('-','_')

        # Create graph
        ta.Graph(name=graph_name)
        self.assertTrue(graph_name in ta.get_graph_names(), graph_name + " should be in the list of graphs")

        # Try to create a model with the same name as the graph (we expect an exception)
        with self.assertRaises(Exception):
            ta.KMeansModel(name=graph_name)
Exemplo n.º 9
0
    def test_create_kmeans_model_with_duplicte_graph_name(self):
        graph_name = str(uuid.uuid1()).replace('-', '_')

        # Create graph
        ta.Graph(name=graph_name)
        self.assertTrue(graph_name in ta.get_graph_names(),
                        graph_name + " should be in the list of graphs")

        # Try to create a model with the same name as the graph (we expect an exception)
        with self.assertRaises(Exception):
            ta.KMeansModel(name=graph_name)
Exemplo n.º 10
0
    def test_duplicate_frame_rename(self):
        frame_name1 = str(uuid.uuid1()).replace('-', '_')
        frame_name2 = str(uuid.uuid1()).replace('-', '_')
        graph_name = str(uuid.uuid1()).replace('-', '_')
        model_name = str(uuid.uuid1()).replace('-', '_')

        # Create frames, graph, and model to test with
        frame1 = ta.Frame(name=frame_name1)
        frame2 = ta.Frame(name=frame_name2)
        ta.Graph(name=graph_name)
        ta.KMeansModel(name=model_name)

        # After creating frames, check that frames with each name exists on the server
        self.assertTrue(frame_name1 in ta.get_frame_names(),
                        frame_name1 + " should exist in list of frames")
        self.assertTrue(frame_name2 in ta.get_frame_names(),
                        frame_name2 + " should exist in list of frames")

        # Try to rename frame2 to have the same name as frame1 (we expect an exception here)
        with self.assertRaises(Exception):
            frame2.name = frame_name1

        # Both frame names should still exist on the server
        self.assertTrue(frame_name1 in ta.get_frame_names(),
                        frame_name1 + " should still exist in list of frames")
        self.assertTrue(frame_name2 in ta.get_frame_names(),
                        frame_name2 + " should still exist in list of frames")

        # Try to rename frame1 to have the same name as the graph (we expect an exception here)
        with self.assertRaises(Exception):
            frame1.name = graph_name

        # frame1 and the graph should still exist on the server
        self.assertTrue(
            frame_name1 in ta.get_frame_names(),
            frame_name1 + " should still exist in the list of frames")
        self.assertTrue(
            graph_name in ta.get_graph_names(),
            graph_name + " should still exist in the list of graphs")

        # Try to rename frame1 to have the same name as the model (we expect an exception here)
        with self.assertRaises(Exception):
            frame1.name = model_name

        # frame1 and the model should still exist on the server
        self.assertTrue(
            frame_name1 in ta.get_frame_names(),
            frame_name1 + " should still exist in the list of frames")
        self.assertTrue(
            model_name in ta.get_model_names(),
            model_name + " should still exist in the list of models")
Exemplo n.º 11
0
    def test_duplicate_model_rename(self):
        model_name1 = str(uuid.uuid1()).replace('-','_')
        model_name2 = str(uuid.uuid1()).replace('-','_')
        graph_name  = str(uuid.uuid1()).replace('-','_')
        frame_name  = str(uuid.uuid1()).replace('-','_')

        # Create models, graph, and frame to test with
        model1 = ta.KMeansModel(name=model_name1)
        model2 = ta.KMeansModel(name=model_name2)
        ta.Graph(name=graph_name)
        ta.Frame(name=frame_name)

        # After creating models, check that models with each name exists on the server
        self.assertTrue(model_name1 in ta.get_model_names(), model_name1 + " should exist in list of models")
        self.assertTrue(model_name2 in ta.get_model_names(), model_name2 + " should exist in list of models")

        # Try to rename model2 to have the same name as model1 (we expect an exception here)
        with self.assertRaises(Exception):
            model2.name = model_name1

        # Both model names should still exist on the server
        self.assertTrue(model_name1 in ta.get_model_names(), model_name1 + " should still exist in list of models")
        self.assertTrue(model_name2 in ta.get_model_names(), model_name2 + " should still exist in list of models")

        # Try to rename model1 to have the same name as the graph (we expect an exception here)
        with self.assertRaises(Exception):
            model1.name = graph_name

        # model1 and the graph should still exist on the server
        self.assertTrue(model_name1 in ta.get_model_names(), model_name1 + " should still exist in the list of models")
        self.assertTrue(graph_name in ta.get_graph_names(), graph_name + " should still exist in the list of graphs")

        # Try to rename model1 to have the same name as the frame (we expect an exception here)
        with self.assertRaises(Exception):
            model1.name = frame_name

        # model1 and the frame should still exist on the server
        self.assertTrue(model_name1 in ta.get_model_names(), model_name1 + " should still exist in the list of models")
        self.assertTrue(frame_name in ta.get_frame_names(), frame_name + " should still exist in the list of frames")
Exemplo n.º 12
0
    def test_drop_graph_that_does_not_exist(self):
        graph_name = str(uuid.uuid1()).replace("-", "_")

        self.assertFalse(graph_name in ta.get_graph_names(), graph_name + " should not exist in the list of graphs")

        self.assertEqual(0, ta.drop_graphs(graph_name), "drop_graphs() shouldn't have deleted any graphs")