Exemplo n.º 1
0
    def setUp(self):
        super(TestQueueMetaData, self).setUp()

        self.queue_url = self.base_url + '/queues/{}'.format(uuid.uuid1())
        http.put(self.queue_url, self.header)

        self.queue_metadata_url = self.queue_url + '/metadata'
Exemplo n.º 2
0
    def setUp(self):
        super(TestQueueMetaData, self).setUp()

        self.queue_url = self.base_url + '/queues/{}'.format(uuid.uuid1())
        http.put(self.queue_url, self.header)

        self.queue_metadata_url = self.queue_url + '/metadata'
Exemplo n.º 3
0
    def test_check_queue_exists(self):
        """Checks if queue exists."""
        url = self.base_url + '/queues/testqueue'
        http.put(url, self.header)

        result = http.get(url, self.header)
        self.assertEqual(result.status_code, 204)

        result = http.head(url, self.header)
        self.assertEqual(result.status_code, 204)
Exemplo n.º 4
0
    def test_check_queue_exists(self):
        """Checks if queue exists."""
        url = self.base_url + '/queues/testqueue'
        http.put(url, self.header)

        result = http.get(url, self.header)
        self.assertEqual(result.status_code, 204)

        result = http.head(url, self.header)
        self.assertEqual(result.status_code, 204)
Exemplo n.º 5
0
    def setUp(self):
        super(TestQueueMisc, self).setUp()

        self.queue = uuid.uuid1()
        self.queue_url = ("%(url)s/%(version)s/queues/%(queue)s" %
                          {'url': self.cfg.marconi.url,
                           'version': self.cfg.marconi.version,
                           'queue': self.queue})

        url = self.queue_url + '/metadata'
        metadata = {"queue_metadata": "TEST METADATA"}
        http.put(url, self.header, json.dumps(metadata))
Exemplo n.º 6
0
    def setUp(self):
        super(TestMessages, self).setUp()

        self.queue = uuid.uuid1()
        self.queue_url = ("%(url)s/%(version)s/queues/%(queue)s" %
                          {'url': self.cfg.marconi.url,
                           'version': self.cfg.marconi.version,
                           'queue': self.queue})

        http.put(self.queue_url, self.header)

        self.message_url = self.queue_url + '/messages'
Exemplo n.º 7
0
    def setUp(self):
        super(TestQueueMisc, self).setUp()

        self.queue = uuid.uuid1()
        self.queue_url = ("%(url)s/%(version)s/queues/%(queue)s" % {
            'url': self.cfg.marconi.url,
            'version': self.cfg.marconi.version,
            'queue': self.queue
        })

        url = self.queue_url + '/metadata'
        metadata = {"queue_metadata": "TEST METADATA"}
        http.put(url, self.header, json.dumps(metadata))
Exemplo n.º 8
0
    def setUp(self):
        super(TestMessages, self).setUp()

        self.queue = uuid.uuid1()
        self.queue_url = ("%(url)s/%(version)s/queues/%(queue)s" % {
            'url': self.cfg.marconi.url,
            'version': self.cfg.marconi.version,
            'queue': self.queue
        })

        http.put(self.queue_url, self.header)

        self.message_url = self.queue_url + '/messages'
Exemplo n.º 9
0
    def test_insert_queue_header_asterisk(self):
        """Insert Queue with 'Accept': '*/*'."""
        self.url = self.base_url + '/queues/asteriskinheader'
        header = copy.copy(self.header)
        header["Accept"] = '*/*'

        result = http.put(self.url, header)
        self.assertEqual(result.status_code, 201)
Exemplo n.º 10
0
    def test_insert_queue_header_asterisk(self):
        """Insert Queue with 'Accept': '*/*'."""
        self.url = self.base_url + '/queues/asteriskinheader'
        header = copy.copy(self.header)
        header["Accept"] = '*/*'

        result = http.put(self.url, header)
        self.assertEqual(result.status_code, 201)
Exemplo n.º 11
0
    def test_insert_queue_header_plaintext(self):
        """Insert Queue with 'Accept': 'plain/text'."""
        self.url = self.base_url + '/queues/plaintextheader'
        header = copy.copy(self.header)
        header["Accept"] = 'plain/text'

        result = http.put(self.url, header)
        self.assertEqual(result.status_code, 406)
Exemplo n.º 12
0
    def test_insert_queue_header_plaintext(self):
        """Insert Queue with 'Accept': 'plain/text'."""
        self.url = self.base_url + '/queues/plaintextheader'
        header = copy.copy(self.header)
        header["Accept"] = 'plain/text'

        result = http.put(self.url, header)
        self.assertEqual(result.status_code, 406)
Exemplo n.º 13
0
    def test_insert_queue_metadata(self, doc):
        """Insert Queue with empty json."""
        result = http.put(self.queue_metadata_url, self.header,
                          json.dumps(doc))
        self.assertEqual(result.status_code, 204)

        result = http.get(self.queue_metadata_url, self.header)
        self.assertEqual(result.status_code, 200)
        self.assertEqual(result.json(), doc)
Exemplo n.º 14
0
    def test_insert_queue_metadata(self, doc):
        """Insert Queue with empty json."""
        result = http.put(self.queue_metadata_url, self.header,
                          json.dumps(doc))
        self.assertEqual(result.status_code, 204)

        result = http.get(self.queue_metadata_url, self.header)
        self.assertEqual(result.status_code, 200)
        self.assertEqual(result.json(), doc)
Exemplo n.º 15
0
    def setUp(self):
        super(TestClaims, self).setUp()

        self.queue = uuid.uuid1()
        self.queue_url = ("%(url)s/%(version)s/queues/%(queue)s" %
                          {'url': self.cfg.marconi.url,
                           'version': self.cfg.marconi.version,
                           'queue': self.queue})

        http.put(self.queue_url, self.header)

        self.claim_url = self.queue_url + '/claims'

        #Post Messages
        url = self.queue_url + '/messages'
        doc = helpers.get_message_body(messagecount=
                                       self.limits.message_paging_uplimit)
        for i in range(25):
            http.post(url, self.header, doc)
Exemplo n.º 16
0
    def test_insert_queue_invalid_name(self, queue_name):
        """Create Queue."""
        self.url = self.base_url + '/queues/' + queue_name

        result = http.put(self.url, self.header)
        self.assertEqual(result.status_code, 400)

        self.url = self.url + '/metadata'
        result = http.get(self.url, self.header)
        self.assertEqual(result.status_code, 404)
Exemplo n.º 17
0
    def test_insert_queue_invalid_name(self, queue_name):
        """Create Queue."""
        self.url = self.base_url + '/queues/' + queue_name

        result = http.put(self.url, self.header)
        self.assertEqual(result.status_code, 400)

        self.url = self.url + '/metadata'
        result = http.get(self.url, self.header)
        self.assertEqual(result.status_code, 404)
Exemplo n.º 18
0
    def setUp(self):
        super(TestClaims, self).setUp()

        self.queue = uuid.uuid1()
        self.queue_url = ("%(url)s/%(version)s/queues/%(queue)s" % {
            'url': self.cfg.marconi.url,
            'version': self.cfg.marconi.version,
            'queue': self.queue
        })

        http.put(self.queue_url, self.header)

        self.claim_url = self.queue_url + '/claims'

        #Post Messages
        url = self.queue_url + '/messages'
        doc = helpers.get_message_body(
            messagecount=self.limits.message_paging_uplimit)
        for i in range(25):
            http.post(url, self.header, doc)
Exemplo n.º 19
0
    def test_insert_queue_with_metadata(self):
        """Insert queue with a non-empty request body."""
        self.url = self.base_url + '/queues/hasmetadata'
        doc = '{"queue": "Has Metadata"}'
        result = http.put(self.url, self.header, doc)

        self.assertEqual(result.status_code, 201)

        self.url = self.base_url + '/queues/hasmetadata/metadata'
        result = http.get(self.url, self.header)

        self.assertEqual(result.status_code, 200)
        self.assertEqual(result.json(), {})
Exemplo n.º 20
0
    def test_insert_queue_with_metadata(self):
        """Insert queue with a non-empty request body."""
        self.url = self.base_url + '/queues/hasmetadata'
        doc = '{"queue": "Has Metadata"}'
        result = http.put(self.url, self.header, doc)

        self.assertEqual(result.status_code, 201)

        self.url = self.base_url + '/queues/hasmetadata/metadata'
        result = http.get(self.url, self.header)

        self.assertEqual(result.status_code, 200)
        self.assertEqual(result.json(), {})
Exemplo n.º 21
0
    def test_insert_queue(self, queue_name):
        """Create Queue."""
        self.url = self.base_url + '/queues/' + queue_name

        result = http.put(self.url, self.header)
        self.assertEqual(result.status_code, 201)

        response_headers = set(result.headers.keys())
        self.assertIsSubset(self.headers_response_empty, response_headers)

        self.url = self.url + '/metadata'
        result = http.get(self.url, self.header)
        self.assertEqual(result.status_code, 200)
        self.assertEqual(result.json(), {})
Exemplo n.º 22
0
    def test_insert_queue(self, queue_name):
        """Create Queue."""
        self.url = self.base_url + '/queues/' + queue_name

        result = http.put(self.url, self.header)
        self.assertEqual(result.status_code, 201)

        response_headers = set(result.headers.keys())
        self.assertIsSubset(self.headers_response_empty, response_headers)

        self.url = self.url + '/metadata'
        result = http.get(self.url, self.header)
        self.assertEqual(result.status_code, 200)
        self.assertEqual(result.json(), {})
Exemplo n.º 23
0
    def test_insert_queue_invalid_authtoken(self):
        """Insert Queue with invalid authtoken."""

        # NOTE(flaper87): Currently, tearDown
        # depends on this attribute. Needs to
        # be fixed.
        self.url = self.base_url + '/queues/invalidauthtoken'

        if not self.cfg.auth.auth_on:
            self.skipTest("Auth is not on!")

        header = copy.copy(self.header)
        header["X-Auth-Token"] = 'invalid'

        result = http.put(self.url, header)
        self.assertEqual(result.status_code, 401)
Exemplo n.º 24
0
    def test_insert_queue_invalid_authtoken(self):
        """Insert Queue with invalid authtoken."""

        # NOTE(flaper87): Currently, tearDown
        # depends on this attribute. Needs to
        # be fixed.
        self.url = self.base_url + '/queues/invalidauthtoken'

        if not self.cfg.auth.auth_on:
            self.skipTest("Auth is not on!")

        header = copy.copy(self.header)
        header["X-Auth-Token"] = 'invalid'

        result = http.put(self.url, header)
        self.assertEqual(result.status_code, 401)
Exemplo n.º 25
0
    def test_insert_queue_invalid_metadata(self, doc):
        """Insert invalid metadata."""

        result = http.put(self.queue_metadata_url, self.header, str(doc))
        self.assertEqual(result.status_code, 400)
Exemplo n.º 26
0
    def test_insert_queue_invalid_metadata(self, doc):
        """Insert invalid metadata."""

        result = http.put(self.queue_metadata_url, self.header, str(doc))
        self.assertEqual(result.status_code, 400)