コード例 #1
0
    def setUp(self):
        super(TestInsertQueue, self).setUp()
        self.base_url = '{0}/{1}'.format(self.cfg.marconi.url, "v1")

        self.header = helpers.create_marconi_headers(self.cfg)
        self.headers_response_empty = set(['location'])
        self.client.set_base_url(self.base_url)
        self.header = helpers.create_marconi_headers(self.cfg)
コード例 #2
0
ファイル: test_queues.py プロジェクト: queertypes/marconi
    def setUp(self):
        super(TestInsertQueue, self).setUp()
        self.base_url = "{0}/{1}".format(self.cfg.marconi.url, self.cfg.marconi.version)

        self.header = helpers.create_marconi_headers(self.cfg)
        self.headers_response_empty = set(["location"])
        self.client.set_base_url(self.base_url)
        self.header = helpers.create_marconi_headers(self.cfg)
コード例 #3
0
ファイル: test_queues.py プロジェクト: queertypes/marconi
    def setUp(self):
        super(TestQueueNonExisting, self).setUp()
        self.base_url = "{0}/{1}".format(self.cfg.marconi.url, self.cfg.marconi.version)
        self.queue_url = self.base_url + "/queues/0a5b1b85-4263-11e3-b034-28cfe91478b9"
        self.client.set_base_url(self.queue_url)

        self.header = helpers.create_marconi_headers(self.cfg)
        self.headers_response_empty = set(["location"])
        self.header = helpers.create_marconi_headers(self.cfg)
コード例 #4
0
    def setUp(self):
        super(TestInsertQueue, self).setUp()
        self.base_url = '{0}/{1}'.format(self.cfg.marconi.url,
                                         "v1")

        self.header = helpers.create_marconi_headers(self.cfg)
        self.headers_response_empty = set(['location'])
        self.client.set_base_url(self.base_url)
        self.header = helpers.create_marconi_headers(self.cfg)
コード例 #5
0
    def setUp(self):
        super(TestQueueNonExisting, self).setUp()
        self.base_url = '{0}/{1}'.format(self.cfg.marconi.url, "v1")
        self.queue_url = (self.base_url +
                          '/queues/0a5b1b85-4263-11e3-b034-28cfe91478b9')

        self.client.set_base_url(self.queue_url)

        self.header = helpers.create_marconi_headers(self.cfg)
        self.headers_response_empty = set(['location'])
        self.header = helpers.create_marconi_headers(self.cfg)
コード例 #6
0
ファイル: test_queues.py プロジェクト: balajiiyer/marconi
    def setUp(self):
        super(TestQueueNonExisting, self).setUp()
        self.base_url = '{0}/{1}'.format(self.cfg.marconi.url,
                                         self.cfg.marconi.version)
        self.queue_url = self.base_url + \
            '/queues/0a5b1b85-4263-11e3-b034-28cfe91478b9'
        self.client.set_base_url(self.queue_url)

        self.header = helpers.create_marconi_headers(self.cfg)
        self.headers_response_empty = set(['location'])
        self.header = helpers.create_marconi_headers(self.cfg)
コード例 #7
0
    def setUp(self):
        super(FunctionalTestBase, self).setUp()

        # NOTE(flaper87): Config can't be a class
        # attribute because it may be necessary to
        # modify it at runtime which will affect
        # other instances running instances.
        self.cfg = config.load_config()

        if not self.cfg.run_tests:
            self.skipTest("Functional tests disabled")

        self.mconf = self.load_conf(self.cfg.marconi.config)

        # NOTE(flaper87): Use running instances.
        if (self.cfg.marconi.run_server and not self.server):
            self.server = self.server_class()
            self.server.start(self.mconf)

        validator = validation.Validator(self.mconf)
        self.limits = validator._limits_conf

        # NOTE(flaper87): Create client
        # for this test unit.
        self.client = http.Client()
        self.headers = helpers.create_marconi_headers(self.cfg)

        if self.cfg.auth.auth_on:
            auth_token = helpers.get_keystone_token(self.cfg, self.client)
            self.headers["X-Auth-Token"] = auth_token

        self.headers_response_with_body = set(['location', 'content-type'])

        self.client.set_headers(self.headers)
コード例 #8
0
ファイル: test_messages.py プロジェクト: pombredanne/marconi
    def setUpClass(cls):
        cls.cfg = config.load_config()
        cls.mconf = cls.load_conf(cls.cfg.marconi.config).conf
        cls.limits = cls.mconf['limits:transport']

        cls.header = helpers.create_marconi_headers(cls.cfg)
        cls.headers_response_with_body = set(['location', 'content-type'])
コード例 #9
0
ファイル: base.py プロジェクト: amitgandhinz/marconi
    def setUp(self):
        super(FunctionalTestBase, self).setUp()

        # NOTE(flaper87): Config can't be a class
        # attribute because it may be necessary to
        # modify it at runtime which will affect
        # other instances running instances.
        self.cfg = config.load_config()

        if not self.cfg.run_tests:
            self.skipTest("Functional tests disabled")

        # NOTE(flaper87): Use running instances.
        if (self.cfg.marconi.run_server and not
                self.server):
            self.server = self.server_class()
            self.server.start(self.conf_path(self.cfg.marconi.config))

        self.mconf = self.load_conf(self.cfg.marconi.config).conf
        self.limits = self.mconf['limits:transport']

        # NOTE(flaper87): Create client
        # for this test unit.
        self.client = http.Client()
        self.header = helpers.create_marconi_headers(self.cfg)

        if self.cfg.auth.auth_on:
            auth_token = helpers.get_keystone_token(self.cfg, self.client)
            self.header["X-Auth-Token"] = auth_token

        self.headers_response_with_body = set(['location',
                                               'content-type'])

        self.client.set_headers(self.header)
コード例 #10
0
ファイル: test_claims.py プロジェクト: pombredanne/marconi
    def setUpClass(cls):
        cls.cfg = config.load_config()
        cls.mconf = cls.load_conf(cls.cfg.marconi.config).conf
        cls.limits = cls.mconf['limits:transport']

        cls.header = helpers.create_marconi_headers(cls.cfg)
        cls.headers_response_with_body = set(['location',
                                              'content-type'])
コード例 #11
0
    def test_get_messages_invalid_client_id(self, client_id):
        """Get messages with invalid client id."""
        url = self.message_url

        header = helpers.create_marconi_headers(self.cfg)
        header['Client-ID'] = client_id

        result = self.client.get(url, headers=header)
        self.assertEqual(result.status_code, 400)
コード例 #12
0
ファイル: test_messages.py プロジェクト: chadlung/marconi
    def test_get_messages_invalid_client_id(self, client_id):
        """Get messages with invalid client id."""
        url = self.message_url

        header = helpers.create_marconi_headers(self.cfg)
        header['Client-ID'] = client_id

        result = self.client.get(url, headers=header)
        self.assertEqual(result.status_code, 400)
コード例 #13
0
    def setUp(self):
        super(TestMessages, self).setUp()

        self.queue = uuid.uuid1()  # Generate a random queue ID
        self.queue_url = ("{url}/{version}/queues/{queue}".format(
            url=self.cfg.marconi.url, version="v1.1", queue=self.queue))

        self.headers = helpers.create_marconi_headers(self.cfg)
        self.client.headers = self.headers

        self.client.put(self.queue_url)  # Create the queue
        self.message_url = self.queue_url + '/messages'
        self.client.set_base_url(self.message_url)
コード例 #14
0
    def setUp(self):
        super(TestShards, self).setUp()

        self.shard_url = ("{url}/{version}/shards".format(
            url=self.cfg.marconi.url,
            version="v1.1"
        ))
        self.cfg.marconi.version = "v1.1"

        self.skipTest("NOT IMPLEMENTED")

        self.headers = helpers.create_marconi_headers(self.cfg)
        self.client.headers = self.headers

        self.client.set_base_url(self.shard_url)
コード例 #15
0
    def setUp(self):
        super(TestMessages, self).setUp()

        self.queue = uuid.uuid1()  # Generate a random queue ID
        self.queue_url = ("{url}/{version}/queues/{queue}".format(
            url=self.cfg.marconi.url,
            version="v1.1",
            queue=self.queue))

        self.headers = helpers.create_marconi_headers(self.cfg)
        self.client.headers = self.headers

        self.client.put(self.queue_url)  # Create the queue
        self.message_url = self.queue_url + '/messages'
        self.client.set_base_url(self.message_url)
コード例 #16
0
ファイル: base.py プロジェクト: bentwire/marconi
    def setUp(self):
        super(FunctionalTestBase, self).setUp()

        # NOTE(flaper87): Config can't be a class
        # attribute because it may be necessary to
        # modify it at runtime which will affect
        # other instances running instances.
        self.cfg = config.load_config()

        if not self.cfg.run_tests:
            self.skipTest("Functional tests disabled")

        self.mconf = self.load_conf(self.cfg.marconi.config)

        validator = validation.Validator(self.mconf)
        self.limits = validator._limits_conf
        self.response = response.ResponseSchema(self.limits)

        if _TEST_INTEGRATION:
            # TODO(kgriffs): This code should be replaced to use
            # an external wsgi server instance.

            # NOTE(flaper87): Use running instances.
            if self.cfg.marconi.run_server:
                if not (self.server and self.server.is_alive()):
                    # pylint: disable=not-callable
                    self.server = self.server_class()
                    self.server.start(self.mconf)

            self.client = http.Client()
        else:
            self.client = http.WSGIClient(
                bootstrap.Bootstrap(config.cfg.CONF).transport.app)

        self.headers = helpers.create_marconi_headers(self.cfg)

        if self.cfg.auth.auth_on:
            auth_token = helpers.get_keystone_token(self.cfg, self.client)
            self.headers["X-Auth-Token"] = auth_token

        self.headers_response_with_body = set(['location',
                                               'content-type'])

        self.client.set_headers(self.headers)
コード例 #17
0
    def setUp(self):
        super(FunctionalTestBase, self).setUp()

        # NOTE(flaper87): Config can't be a class
        # attribute because it may be necessary to
        # modify it at runtime which will affect
        # other instances running instances.
        self.cfg = config.load_config()

        if not self.cfg.run_tests:
            self.skipTest("Functional tests disabled")

        self.mconf = self.load_conf(self.cfg.marconi.config)

        validator = validation.Validator(self.mconf)
        self.limits = validator._limits_conf
        self.response = response.ResponseSchema(self.limits)

        if _TEST_INTEGRATION:
            # TODO(kgriffs): This code should be replaced to use
            # an external wsgi server instance.

            # NOTE(flaper87): Use running instances.
            if self.cfg.marconi.run_server:
                if not (self.server and self.server.is_alive()):
                    # pylint: disable=not-callable
                    self.server = self.server_class()
                    self.server.start(self.mconf)

            self.client = http.Client()
        else:
            self.client = http.WSGIClient(
                bootstrap.Bootstrap(config.cfg.CONF).transport.app)

        self.headers = helpers.create_marconi_headers(self.cfg)

        if self.cfg.auth.auth_on:
            auth_token = helpers.get_keystone_token(self.cfg, self.client)
            self.headers["X-Auth-Token"] = auth_token

        self.headers_response_with_body = set(['location', 'content-type'])

        self.client.set_headers(self.headers)
コード例 #18
0
    def setUp(self):
        super(TestClaims, self).setUp()

        self.headers = helpers.create_marconi_headers(self.cfg)
        self.client.headers = self.headers

        self.queue = uuid.uuid1()
        self.queue_url = ("{url}/{version}/queues/{queue}".format(
                          url=self.cfg.marconi.url,
                          version="v1.1",
                          queue=self.queue))

        self.client.put(self.queue_url)

        self.claim_url = self.queue_url + '/claims'
        self.client.set_base_url(self.claim_url)

        # Post Messages
        url = self.queue_url + '/messages'
        doc = helpers.create_message_body(
            messagecount=self.limits.max_messages_per_page)

        for i in range(10):
            self.client.post(url, data=doc)