コード例 #1
0
    def test_properties_router_get_property(self, responses):
        responses_callback(responses)

        pr = PropertiesRouter(url, headers, True)
        prop = pr.get_property('test.example.com', 'zWinTrustedRealm')
        assert isinstance(prop, ZenossProperty)
        assert prop.id == 'zWinTrustedRealm'
コード例 #2
0
    def test_properties_router_list_local_properties(self, responses):
        responses_callback(responses)

        pr = PropertiesRouter(url, headers, True)
        props = pr.list_local_properties('test.example.com')
        assert props['total'] == 2
        assert len(props['properties']) == 2
        assert props['properties'][0]['id'] == "zMySQLConnectionString"
コード例 #3
0
    def test_properties_router_list_properties(self, responses):
        responses_callback(responses)

        pr = PropertiesRouter(url, headers, True)
        props = pr.list_properties('test.example.com')
        assert props['total'] == 4
        assert len(props['properties']) == 4
        assert props['properties'][0]['id'] == "zAggregatorCollectionInterval"
コード例 #4
0
    def test_properties_router_zenossproperty_delete_non_local(
            self, responses):
        responses_callback(responses)

        pr = PropertiesRouter(url, headers, True)
        prop = pr.get_property('test.example.com', 'zWinTrustedRealm')
        assert prop.islocal == 0
        assert not prop.delete()
コード例 #5
0
    def test_properties_router_set_property_value(self, responses):
        responses_callback(responses)

        pr = PropertiesRouter(url, headers, True)
        prop = pr.set_property_value('test.example.com',
                                     'zWinTrustedRealm',
                                     value='Westeros')
        assert prop['value'] == "Westeros"
コード例 #6
0
    def test_properties_router_get_custom_property(self, responses):
        responses_callback(responses)

        pr = PropertiesRouter(url, headers, True)
        prop = pr.get_custom_property('test.example.com', 'cDateTest')
        assert isinstance(prop, ZenossCustomProperty)
        assert prop.id == "cDateTest"
        assert prop.path == "Devices/"
コード例 #7
0
    def test_properties_router_get_local_properties(self, responses):
        responses_callback(responses)

        pr = PropertiesRouter(url, headers, True)
        props = pr.get_local_properties('test.example.com')
        assert props['total'] == 2
        assert len(props['properties']) == 2
        assert isinstance(props['properties'][0], ZenossProperty)
        assert props['properties'][0].id == "zMySQLConnectionString"
コード例 #8
0
    def test_properties_router_get_properties(self, responses):
        responses_callback(responses)

        pr = PropertiesRouter(url, headers, True)
        props = pr.get_properties('test.example.com')
        assert props['total'] == 4
        assert len(props['properties']) == 4
        assert isinstance(props['properties'][0], ZenossProperty)
        assert props['properties'][0].id == "zAggregatorCollectionInterval"
コード例 #9
0
    def test_properties_router_zenosscustomproperty_delete_non_local(
            self, responses):
        responses_callback(responses)

        pr = PropertiesRouter(url, headers, True)
        props = pr.get_custom_properties('test.example.com')
        prop = props['properties'][0]
        assert prop.islocal == 0
        assert not prop.delete()
コード例 #10
0
    def test_properties_router_get_custom_properties(self, responses):
        responses_callback(responses)

        pr = PropertiesRouter(url, headers, True)
        props = pr.get_custom_properties('test.example.com')
        assert props['total'] == 1
        assert len(props['properties']) == 1
        assert isinstance(props['properties'][0], ZenossCustomProperty)
        assert props['properties'][0].id == "cDateTest"
コード例 #11
0
    def test_properties_router_list_custom_properties(self, responses):
        responses_callback(responses)

        pr = PropertiesRouter(url, headers, True)
        props = pr.list_custom_properties('test.example.com')
        assert props['total'] == 1
        assert len(props['properties']) == 1
        assert props['properties'][0]['id'] == "cDateTest"
        assert props['properties'][0]['path'] == "/"
コード例 #12
0
    def test_properties_router_zenossproperty_set_value(self, responses):
        responses_callback(responses)

        pr = PropertiesRouter(url, headers, True)
        prop = pr.get_property('test.example.com', 'zWinTrustedRealm')
        assert prop.id == "zWinTrustedRealm"
        assert prop.path == "Devices/"
        assert prop.set_value(
            path='Devices/Server/TEST/devices/test.example.com',
            value='Westeros')
        assert prop.value == "Westeros"
        assert prop.path == "Devices/Server/TEST/devices/test.example.com"
コード例 #13
0
    def test_properties_router_zenosscustomproperty_set_value(self, responses):
        responses_callback(responses)

        pr = PropertiesRouter(url, headers, True)
        props = pr.get_custom_properties('test.example.com')
        prop = props['properties'][0]
        assert prop.id == "cDateTest"
        assert prop.value == "1900/01/01 00:00:00 US/Central"
        assert prop.path == "Devices/"
        assert prop.set_value(
            path='Devices/Server/TEST/devices/test.example.com',
            value="2017/12/19 00:00:00 US/Pacific")
        assert prop.value == "2017/12/19 00:00:00 US/Pacific"
        assert prop.path == "Devices/Server/TEST/devices/test.example.com"
コード例 #14
0
    def test_properties_router_zenosscustomproperty_delete(self, responses):
        responses_callback(responses)

        pr = PropertiesRouter(url, headers, True)
        props = pr.get_custom_properties('test.example.com',
                                         params=dict(id='cDateTest',
                                                     islocal=1))
        prop = props['properties'][0]
        assert prop.islocal == 1
        assert prop.path == "Devices/Server/TEST/devices/test.example.com"
        assert prop.value == "2017/12/19 00:00:00 US/Pacific"
        assert prop.delete()
        assert prop.islocal == 0
        assert prop.path == "/"
        assert prop.value == "1900/01/01 00:00:00 US/Central"
コード例 #15
0
    def test_properties_router_zenossproperty_delete(self, responses):
        responses_callback(responses)

        pr = PropertiesRouter(url, headers, True)
        props = pr.get_properties('test.example.com',
                                  params=dict(id='zWinTrustedRealm',
                                              islocal=1))
        prop = props['properties'][0]
        assert prop.islocal == 1
        assert prop.value == "Westeros"
        assert prop.path == "Devices/Server/TEST/devices/test.example.com"
        assert prop.delete()
        assert prop.islocal == 0
        assert prop.id == "zWinTrustedRealm"
        assert prop.path == "/"
コード例 #16
0
 def test_properties_router_init(self):
     pr = PropertiesRouter(url, headers, True)
     assert pr.id is None