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

        dmr = DeviceManagementRouter(url, headers, False)
        uc = dmr.get_user_command_by_name(
            'Server/TEST/devices/test.example.com', 'uname_a')
        resp = uc.delete()
        assert resp['data'] is None
Beispiel #2
0
    def test_devicemanagement_router_zenossusercommand_update(self, responses):
        responses_callback(responses)

        dmr = DeviceManagementRouter(url, headers, False)
        uc = dmr.get_user_command_by_name(
            'Server/TEST/devices/test2.example.com', 'uname_a')
        resp = uc.update(description="Run uname -a command", password="******")
        assert resp
        assert uc.description == "Run uname -a command"
Beispiel #3
0
    def test_devicemanagement_router_get_user_command_by_name(self, responses):
        responses_callback(responses)

        dmr = DeviceManagementRouter(url, headers, False)
        resp = dmr.get_user_command_by_name('Server/TEST', 'ping')
        assert isinstance(resp, ZenossUserCommand)
        assert resp.id == "ping"
        assert resp.description == "Is the device responding to ping?"
        assert resp.meta_type == "UserCommand"
        assert resp.name == "ping"
        assert resp.command == "${device/pingCommand} -c2 ${device/manageIp}"
        assert resp.uid == "userCommands/ping"
        assert resp.parent == "Devices/Server/TEST"
Beispiel #4
0
    def test_devicemanagement_router_zenossusercommand_update_bad_passwd(
            self, responses):
        responses_callback(responses)

        dmr = DeviceManagementRouter(url, headers, False)
        uc = dmr.get_user_command_by_name(
            'Server/TEST/devices/test2.example.com', 'uname_a')
        with pytest.raises(
                ZenossAPIClientError,
                message=
                "Request failed: Exception: Update failed. Incorrect or missing password."
        ):
            resp = uc.update(description="Run uname -a command",
                             password="******")