Beispiel #1
0
    def test_template_router_zenosstemplate_delete_graph(self, responses):
        responses_callback(responses)

        tr = TemplateRouter(url, headers, True)
        zt = tr.get_template('Server/TEST', 'FileSystem')
        resp = zt.delete_graph('Usage')
        assert resp['success']
Beispiel #2
0
    def test_template_router_zenosstemplate_delete_threshold(self, responses):
        responses_callback(responses)

        tr = TemplateRouter(url, headers, True)
        zt = tr.get_template('Server/TEST', 'FileSystem')
        resp = zt.delete_threshold('90 percent used')
        assert resp['success']
Beispiel #3
0
    def test_template_router_zenosstemplate_copy(self, responses):
        responses_callback(responses)

        tr = TemplateRouter(url, headers, True)
        zt = tr.get_template('Server/TEST', 'LogicalVolume')
        resp = zt.copy('Server')
        assert isinstance(resp, ZenossTemplate)
Beispiel #4
0
    def test_temmplate_router_zenosstemplate_get_data_source_not_found(self, responses):
        responses_callback(responses)

        tr = TemplateRouter(url, headers, True)
        zt = tr.get_template('Server/TEST', 'LogicalVolume')
        with pytest.raises(ZenossAPIClientError, message="Request failed: ObjectNotFoundException"):
            resp = zt.get_data_source('bad')
Beispiel #5
0
    def test_template_router_zenosstemplate_delete_data_source(self, responses):
        responses_callback(responses)

        tr = TemplateRouter(url, headers, True)
        zt = tr.get_template('Server/TEST', 'LogicalVolume')
        resp = zt.delete_data_source('status')
        assert resp['success']
Beispiel #6
0
    def test_template_router_zenossthreshold_set_min(self, responses):
        responses_callback(responses)

        tr = TemplateRouter(url, headers, True)
        zt = tr.get_template('Server/TEST', 'FileSystem')
        threshold = zt.get_threshold('90 percent used')
        threshold.set_min(1)
Beispiel #7
0
    def test_template_router_get_template(self, responses):
        responses_callback(responses)

        tr = TemplateRouter(url, headers, True)
        resp = tr.get_template('Devices', 'Device')
        assert isinstance(resp, ZenossTemplate)
        assert resp.uid == "Devices/Server/TEST/rrdTemplates/Device"
Beispiel #8
0
    def test_template_router_zenosstemplate_get_graphs(self, responses):
        responses_callback(responses)

        tr = TemplateRouter(url, headers, True)
        zt = tr.get_template('Server/TEST', 'FileSystem')
        resp = zt.get_graphs()
        assert len(resp) == 1
        assert isinstance(resp[0], ZenossGraph)
Beispiel #9
0
    def test_template_router_zenosstemplate_list_graphs(self, responses):
        responses_callback(responses)

        tr = TemplateRouter(url, headers, True)
        zt = tr.get_template('Server/TEST', 'FileSystem')
        resp = zt.list_graphs()
        assert len(resp) == 1
        assert resp[0] == "Devices/Server/TEST/rrdTemplates/FileSystem/graphDefs/Usage"
Beispiel #10
0
    def test_template_router_zenosstemplate_add_threshold(self, responses):
        responses_callback(responses)

        tr = TemplateRouter(url, headers, True)
        zt = tr.get_template('Server/TEST', 'FileSystem')
        resp = zt.add_threshold('90 percent used', 'MinMaxThreshold', ['dp'])
        assert isinstance(resp, ZenossThreshold)
        assert resp.uid == "Devices/Server/TEST/rrdTemplates/FileSystem/thresholds/90 percent used"
Beispiel #11
0
    def test_template_router_zenosstemplate_list_thresholds(self, responses):
        responses_callback(responses)

        tr = TemplateRouter(url, headers, True)
        zt = tr.get_template('Server/TEST', 'FileSystem')
        resp = zt.list_thresholds()
        assert len(resp) == 2
        assert resp[0] == "Devices/Server/TEST/rrdTemplates/FileSystem/thresholds/90 percent used"
Beispiel #12
0
    def test_template_router_zenosstemplate_get_data_points(self, responses):
        responses_callback(responses)

        tr = TemplateRouter(url, headers, True)
        zt = tr.get_template('Server/TEST', 'LogicalVolume')
        resp = zt.get_data_points()
        assert len(resp) == 2
        assert isinstance(resp[0], ZenossDataPoint)
Beispiel #13
0
    def test_template_router_zenosstemplate_list_data_points(self, responses):
        responses_callback(responses)

        tr = TemplateRouter(url, headers, True)
        zt = tr.get_template('Server/TEST', 'LogicalVolume')
        resp = zt.list_data_points()
        assert len(resp) == 2
        assert resp[0] == "Devices/Server/TEST/rrdTemplates/LogicalVolume/datasources/status/datapoints/state"
Beispiel #14
0
    def test_template_router_zenosstemplate_add_data_source(self, responses):
        responses_callback(responses)

        tr = TemplateRouter(url, headers, True)
        zt = tr.get_template('Server/TEST', 'LogicalVolume')
        resp = zt.add_data_source('status', 'COMMAND')
        assert isinstance(resp, ZenossDataSource)
        assert resp.uid == "Devices/Server/TEST/rrdTemplates/LogicalVolume/datasources/status"
Beispiel #15
0
    def test_template_router_zenossgraph_add_graph_threshold(self, responses):
        responses_callback(responses)

        tr = TemplateRouter(url, headers, True)
        zt = tr.get_template('Server/TEST', 'FileSystem')
        graph = zt.get_graph('Usage')
        resp = graph.add_graph_threshold('Devices/Server/TEST/rrdTemplates/FileSystem/thresholds/90 percent used')
        assert resp['success']
Beispiel #16
0
    def test_template_router_zenossgraph_set_point_sequence(self, responses):
        responses_callback(responses)

        tr = TemplateRouter(url, headers, True)
        zt = tr.get_template('Server/TEST', 'FileSystem')
        graph = zt.get_graph('Usage')
        resp = graph.set_point_sequence(['Used'])
        assert resp['success']
Beispiel #17
0
    def test_template_router_zenosstemplate_add_graph(self, responses):
        responses_callback(responses)

        tr = TemplateRouter(url, headers, True)
        zt = tr.get_template('Server/TEST', 'FileSystem')
        resp = zt.add_graph('Usage')
        assert isinstance(resp, ZenossGraph)
        assert resp.uid == "Devices/Server/TEST/rrdTemplates/FileSystem/graphDefs/Usage"
Beispiel #18
0
    def test_template_router_zenossgraph_add_point(self, responses):
        responses_callback(responses)

        tr = TemplateRouter(url, headers, True)
        zt = tr.get_template('Server/TEST', 'FileSystem')
        graph = zt.get_graph('Usage')
        resp = graph.add_point('disk', 'usedBlocks')
        assert resp['success']
Beispiel #19
0
    def test_template_router_zenossgraph_set_graph_properties(self, responses):
        responses_callback(responses)

        tr = TemplateRouter(url, headers, True)
        zt = tr.get_template('Server/TEST', 'FileSystem')
        graph = zt.get_graph('Usage')
        resp = graph.set_graph_properties(dict(foo='bar'))
        assert resp['success']
Beispiel #20
0
    def tet_template_router_zenossdatapoint_make_gauge(self, responses):
        responses_callback(responses)

        tr = TemplateRouter(url, headers, True)
        zt = tr.get_template('Server/TEST', 'FileSystem')
        ds = zt.get_data_source('disk')
        dp = ds.get_data_point('disk_percentUsed')
        dp.make_gauge()
Beispiel #21
0
    def test_template_router_zenossgraph_get_points(self, responses):
        responses_callback(responses)

        tr = TemplateRouter(url, headers, True)
        zt = tr.get_template('Server/TEST', 'FileSystem')
        graph = zt.get_graph('Usage')
        resp = graph.get_points()
        assert len(resp) == 1
        assert isinstance(resp[0], ZenossDataPoint)
Beispiel #22
0
    def test_template_router_zenossdatasource_add_data_point(self, responses):
        responses_callback(responses)

        tr = TemplateRouter(url, headers, True)
        zt = tr.get_template('Server/TEST', 'LogicalVolume')
        ds = zt.get_data_source('status')
        resp = ds.get_data_point('state')
        assert isinstance(resp, ZenossDataPoint)
        assert resp.uid == "Devices/Server/TEST/rrdTemplates/LogicalVolume/datasources/status/datapoints/state"
Beispiel #23
0
    def test_template_router_zenossdatapoint_delete(self, responses):
        responses_callback(responses)

        tr = TemplateRouter(url, headers, True)
        zt = tr.get_template('Server/TEST', 'FileSystem')
        ds = zt.get_data_source('disk')
        dp = ds.get_data_point('disk_percentUsed')
        resp = dp.delete()
        assert resp['success']
Beispiel #24
0
    def test_template_router_zenossdatapoint_set_threshold(self, responses):
        responses_callback(responses)

        tr = TemplateRouter(url, headers, True)
        zt = tr.get_template('Server/TEST', 'FileSystem')
        ds = zt.get_data_source('disk')
        dp = ds.get_data_point('disk_percentUsed')
        resp = dp.set_threshold('90 percent used', 'MinMaxThreshold')
        assert isinstance(resp, ZenossThreshold)
        assert resp.uid == "Devices/Server/TEST/rrdTemplates/FileSystem/thresholds/90 percent used"