Commit Graph

14 Commits

Author SHA1 Message Date
xuanyandong be997b53ab Remove unicode literal strings
Co-Authored-By: Cyril Roelandt <cyril@redhat.com>
Change-Id: Id9e1a5fb9c732c207ee08f0dbf387436a1783174
2022-06-30 19:37:03 +02:00
Stephen Finucane 9679ffc463 Remove six.moves.http_client usage
This is a rather beefy change due to the number of usages of this
import. The changes are trivial though.

Change-Id: I7badeeaca438b0291f4ed86670e7f217e6372c61
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2022-01-27 14:54:05 +00:00
Lance Bragstad 07eaf532c7 Remove duplicate _header() implementations in metadef tests
The metadef functional test classes all had their own _header()
implementation and none of them varied. This commit moves the _header()
implementation to a common layer and removes the duplication.

Change-Id: I40942a5dde3cd50a64a5f36fbcb6d9240af25b5e
2021-09-10 08:14:52 -07:00
Lance Bragstad 4e68e5da6f Remove duplicate _url() methods from functional test classes
Most of the functional tests contain a version of _url(). The
implementations don't really differ, outside of one that accepts a
protocol and another that is specific to IPV6 for a single test case.

This commit moves the common method to the functional base class and
removes the duplicated logic across the functional test implementations.

Change-Id: I0b161ad404bdb53e3c1cfe878f78a71c239cf40e
2021-09-10 08:14:52 -07:00
Lance Bragstad 82a8945885 Move global constants to test module setUp
Each metadef test module has its own constants for TENANT1 and TENANT2,
bu they all point to the same underlying value from oslo. This commit
moves the constants to the setUp() method of the base metadef functional
test class and removes the duplication across the metadef tests.

Change-Id: I21e32a34c05b6f091e14c41b4e5a50ccaa294365
2021-09-10 08:14:47 -07:00
Lance Bragstad a8dda8c03c Remove duplicate namespace utilities in functional tests
We're in the process of adding test coverage for the metadef API, which
is sorely needed. This commit introduces two different base classes that
help consolidate some duplication that's grown across the metadef tests.

Since the metadef API contains a whole bunch of nest resources, the
first class is a set of utilities that are handy for creating
metadef resources. This is nice because almost every resources in the
metadef API needs a namespace.

The second class is a subclass of the functional test case, but provides
a layer for metadef-specific test utilities, like assertions. We can
continue using this layer to consolidate test utilities without bloating
the base functional test class.

Change-Id: Ic469ee50b9a3f162fd75a8290766d1e0bb4b26f5
2021-09-10 08:14:11 -07:00
Pranali Deore 9d9d7abe21 Implement project personas for metadef namespaces
This commit updates the policies for metadef namespaces
to use default roles available from keystone.

Co-Authored-By: Abhishek Kekane <akekane@redhat.com>
Implements: blueprint secure-rbac

Change-Id: I7bc678b1f61b204574f3a59b6c686fd771af5f54
2021-09-02 15:40:43 -07:00
Gábor Antal 8a8e5bf56c Extracted HTTP response codes to constants in tests
There are several places in the source code where
HTTP response codes are used as numeric values.

These values are used from six.moves and the
numeric values are replaced by constants.

All of the used status codes were replaced with symbolic constants
from six.moves.http_client.
More about six.moves.http_client can be found at [2],
under the table "Supported renames:".

Also, this change improves code readibility.

This patchset does not extract numeric values from
the code itself, but it can be found at [1].

[1]: Ib9e26dcea927e96e65c626c18421621d3a29a64d
[2]: https://pythonhosted.org/six/#module-six.moves

Change-Id: Idfc7b043552f428f01ac3e47b270ee0639a8f5bc
Closes-Bug: #1520159
2016-10-06 15:17:06 +00:00
Niall Bunting a22f0744a5 Reject bodies for metadef commands
The inital commit missed the metadef commands. This now adds them in
using http://developer.openstack.org/api-ref-image-v2.html as the source
for this information.

Closes-Bug: 1475647

Change-Id: I764e09d9d0e3f2dd2d815b9eca2212075598303c
2016-03-11 16:12:33 +00:00
Wayne Okuma 5369e86e8d Glance metadef tables need unique constraints.
Sometime during Kilo, the unique constraints on
metadef_namespaces (namespace)
metadef_objects(namespace_id, name)
metadef_properties(namespace_id, name)
metadef_tags(namespace_id, name)
metadef_resource_types(name)
were replaced with non-unique indices.

I believe this was done erroneously to make the migrate_repo/versions/scripts
match the db/sqlalchemy/models_metadef.py definitions. Unfortunately, the
schema scripts were correct with the unique constraints and what should have
changed was models_metadef.py.

This bug, puts one more migrate script in place which will rename any
duplicate records it finds to make them unique and then re-establishes
the unique constraints while dropping the non-unique indices. It also,
fixes models_metadef.py and adds in tests to attempt to create duplicates
which should result in an HTTPConflict.

Change-Id: Idf3569a27d64abea3ed6ec92fb77b36a4d6d5fd5
Closes-Bug: 1468946
2015-09-02 22:32:29 -07:00
Doug Hellmann ae21f4dffa Drop use of 'oslo' namespace package
The Oslo libraries have moved all of their code out of the 'oslo'
namespace package into per-library packages. The namespace package was
retained during kilo for backwards compatibility, but will be removed by
the liberty-2 milestone. This change removes the use of the namespace
package, replacing it with the new package names.

The patches in the libraries will be put on hold until application
patches have landed, or L2, whichever comes first. At that point, new
versions of the libraries without namespace packages will be released as
a major version update.

Please merge this patch, or an equivalent, before L2 to avoid problems
with those library releases.

Blueprint: remove-namespace-packages
https://blueprints.launchpad.net/oslo-incubator/+spec/remove-namespace-packages

Change-Id: Ifa8baab33cdb3e606cf175a8c29c3a4ef6c44480
2015-04-28 18:57:45 +00:00
Julien Danjou 581cb4ca43 Switch to oslo.serialization
Change-Id: I983bb5b6e2c7fbbd8556ff0f99212803cb0269e9
2014-10-07 14:58:55 +02:00
Bartosz Fic 0b246bb5f5 Replaces assertEqual with assertTrue and assertFalse
In order to improve coding practices and be aligned to a standard,
self.assertEqual(...,True) statements where replaced with
self.assertTrue and self.assertFalse.

Change-Id: I4150a343493beae03d6f71c88e84f60d14fb60e1
Closes-Bug: #1230127
2014-09-12 10:51:02 +02:00
Wayne Okuma 2e7de07c5a Glance Metadata Definitions Catalog - API
Implements: blueprint metadata-schema-catalog

A common API hosted by the Glance service for vendors, admins,
services, and users to meaningfully define available key / value
pair and tag metadata. The intent is to enable better metadata
collaboration across artifacts, services, and projects for
OpenStack users.

This is about the definition of the available metadata that can
be used on different types of resources (images, artifacts,
volumes, flavors, aggregates, etc). A definition includes the
properties type, its key, it's description, and it's constraints.
This catalogue will not store the values for specific instance
properties.

 - REST API for CRUD on metadef namespace
 - REST API for CRUD on metadef objects
 - REST API for CRUD on metadef properites
 - REST API for CRUD on metadef resource types
 - REST API for JSON schemas on metadef API's

Change-Id: I8e6d88ffee9a9337bf82b1da85648ba638a154ab
DocImpact
Co-Authored-By: Lakshmi N Sampath <lakshmi.sampath@hp.com>
Co-Authored-By: Wayne Okuma <wayne.okuma@hp.com>
Co-Authored-By: Travis Tripp <travis.tripp@hp.com>
Co-Authored-By: Pawel Koniszewski <pawel.koniszewski@intel.com>
Co-Authored-By: Michal Jastrzebski <michal.jastrzebski@intel.com>
Co-Authored-By: Michal Dulko <michal.dulko@intel.com>
2014-08-30 15:48:33 +02:00