Exemplo n.º 1
0
    def test_request_gui(self):
        headers = {"some": "header"}
        status = 200
        body = "content"

        user = "******"
        groups = ["hacluster"]
        is_authenticated = True

        self.set_run_result({
            "headers": headers,
            "status": status,
            "body": b64encode(str.encode(body)).decode(),
        })
        http_request = create_http_request()
        self.request = ruby_pcsd.RubyDaemonRequest(
            ruby_pcsd.SINATRA_GUI,
            http_request,
            {
                "username": user,
                "groups": groups,
                "is_authenticated": is_authenticated,
            },
        )
        result = yield self.wrapper.request_gui(
            http_request,
            user=user,
            groups=groups,
            is_authenticated=is_authenticated,
        )
        self.assert_sinatra_result(result, headers, status, body)
Exemplo n.º 2
0
 def setUp(self):
     self.ruby_response = ""
     self.request = ruby_pcsd.RubyDaemonRequest(ruby_pcsd.SYNC_CONFIGS)
     self.wrapper = create_wrapper()
     patcher = mock.patch.object(self.wrapper, "send_to_ruby",
                                 self.send_to_ruby)
     self.addCleanup(patcher.stop)
     patcher.start()
     super().setUp()
Exemplo n.º 3
0
 def test_request_remote(self):
     headers = {"some": "header"}
     status = 200
     body = "content"
     self.set_run_result({
         "headers": headers,
         "status": status,
         "body": b64encode(str.encode(body)).decode(),
     })
     http_request = create_http_request()
     self.request = ruby_pcsd.RubyDaemonRequest(
         ruby_pcsd.SINATRA_REMOTE,
         http_request,
     )
     result = yield self.wrapper.request_remote(http_request)
     self.assert_sinatra_result(result, headers, status, body)