Skip to content

Commit

Permalink
Renaming base fields
Browse files Browse the repository at this point in the history
_id to pulp_id
_created to pulp_created
_last_updated to pulp_last_updated
_href to pulp_href

ref #5457
https://pulp.plan.io/issues/5457

Required PR: pulp/pulpcore#317
Required PR: pulp/pulpcore-plugin#137
Required PR: pulp/pulp-smash#1220
  • Loading branch information
fao89 committed Oct 9, 2019
1 parent dba56f7 commit fce769c
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 21 deletions.
1 change: 1 addition & 0 deletions CHANGES/5457.removal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Change `_id`, `_created`, `_last_updated`, `_href` to `pulp_id`, `pulp_created`, `pulp_last_updated`, `pulp_href`
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ Create a new Maven remote ``bar``
.. code:: json
{
"_href": "/pulp/api/v3/remotes/maven/maven/2668a20c-3908-4767-b134-531e5145d7b7/",
"pulp_href": "/pulp/api/v3/remotes/maven/maven/2668a20c-3908-4767-b134-531e5145d7b7/",
...
}
``$ export REMOTE_HREF=$(http :24817/pulp/api/v3/remotes/maven/maven/ | jq -r '.results[] | select(.name == "bar") | ._href')``
``$ export REMOTE_HREF=$(http :24817/pulp/api/v3/remotes/maven/maven/ | jq -r '.results[] | select(.name == "bar") | .pulp_href')``

Create a Maven Distribution for the Maven Remote
------------------------------------------------
Expand All @@ -99,7 +99,7 @@ Create a Maven Distribution for the Maven Remote
.. code:: json
{
"_href": "/pulp/api/v3/distributions/67baa17e-0a9f-4302-b04a-dbf324d139de/",
"pulp_href": "/pulp/api/v3/distributions/67baa17e-0a9f-4302-b04a-dbf324d139de/",
...
}
Expand Down
6 changes: 3 additions & 3 deletions docs/workflows/cache.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ Create a new Maven remote ``bar``
.. code:: json
{
"_href": "/pulp/api/v3/remotes/maven/maven/2668a20c-3908-4767-b134-531e5145d7b7/"
"pulp_href": "/pulp/api/v3/remotes/maven/maven/2668a20c-3908-4767-b134-531e5145d7b7/"
}
``$ export REMOTE_HREF=$(http :24817/pulp/api/v3/remotes/maven/maven/ | jq -r '.results[] | select(.name == "bar") | ._href')``
``$ export REMOTE_HREF=$(http :24817/pulp/api/v3/remotes/maven/maven/ | jq -r '.results[] | select(.name == "bar") | .pulp_href')``

Create a Maven Distribution for the Maven Remote
------------------------------------------------
Expand All @@ -26,7 +26,7 @@ Create a Maven Distribution for the Maven Remote
.. code:: json
{
"_href": "/pulp/api/v3/distributions/67baa17e-0a9f-4302-b04a-dbf324d139de/"
"pulp_href": "/pulp/api/v3/distributions/67baa17e-0a9f-4302-b04a-dbf324d139de/"
}
Expand Down
14 changes: 7 additions & 7 deletions pulp_maven/tests/functional/api/test_crud_remotes.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def test_02_create_same_name(self):
@skip_if(bool, "remote", False)
def test_02_read_remote(self):
"""Read a remote by its href."""
remote = self.client.get(self.remote["_href"])
remote = self.client.get(self.remote["pulp_href"])
for key, val in self.remote.items():
with self.subTest(key=key):
self.assertEqual(remote[key], val)
Expand All @@ -63,10 +63,10 @@ def test_02_read_remotes(self):
def test_03_partially_update(self):
"""Update a remote using HTTP PATCH."""
body = _gen_verbose_remote()
self.client.patch(self.remote["_href"], body)
self.client.patch(self.remote["pulp_href"], body)
for key in ("username", "password"):
del body[key]
type(self).remote = self.client.get(self.remote["_href"])
type(self).remote = self.client.get(self.remote["pulp_href"])
for key, val in body.items():
with self.subTest(key=key):
self.assertEqual(self.remote[key], val)
Expand All @@ -75,20 +75,20 @@ def test_03_partially_update(self):
def test_04_fully_update(self):
"""Update a remote using HTTP PUT."""
body = _gen_verbose_remote()
self.client.put(self.remote["_href"], body)
self.client.put(self.remote["pulp_href"], body)
for key in ("username", "password"):
del body[key]
type(self).remote = self.client.get(self.remote["_href"])
type(self).remote = self.client.get(self.remote["pulp_href"])
for key, val in body.items():
with self.subTest(key=key):
self.assertEqual(self.remote[key], val)

@skip_if(bool, "remote", False)
def test_05_delete(self):
"""Delete a remote."""
self.client.delete(self.remote["_href"])
self.client.delete(self.remote["pulp_href"])
with self.assertRaises(HTTPError):
self.client.get(self.remote["_href"])
self.client.get(self.remote["pulp_href"])


class CreateRemoteNoURLTestCase(unittest.TestCase):
Expand Down
10 changes: 5 additions & 5 deletions pulp_maven/tests/functional/api/test_download_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,22 @@ def test_all(self):
client = api.Client(cfg, api.json_handler)

repo = client.post(REPO_PATH, gen_repo())
self.addCleanup(client.delete, repo["_href"])
self.addCleanup(client.delete, repo["pulp_href"])

body = gen_maven_remote()
remote = client.post(MAVEN_REMOTE_PATH, body)
self.addCleanup(client.delete, remote["_href"])
self.addCleanup(client.delete, remote["pulp_href"])

repo = client.get(repo["_href"])
repo = client.get(repo["pulp_href"])

# Create a distribution.
body = gen_distribution()
body["remote"] = remote["_href"]
body["remote"] = remote["pulp_href"]
response_dict = client.post(MAVEN_DISTRIBUTION_PATH, body)
dist_task = client.get(response_dict["task"])
distribution_href = dist_task["created_resources"][0]
distribution = client.get(distribution_href)
self.addCleanup(client.delete, distribution["_href"])
self.addCleanup(client.delete, distribution["pulp_href"])

# Pick a content unit, and download it from both Pulp Fixtures…
unit_path = choice(get_maven_content_paths(repo))
Expand Down
6 changes: 3 additions & 3 deletions pulp_maven/tests/functional/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def gen_maven_content_attrs(artifact):
:returns: A semi-random dict for use in creating a content unit.
"""
# FIXME: Add content specific metadata here.
return {"_artifact": artifact["_href"]}
return {"_artifact": artifact["pulp_href"]}


def populate_pulp(cfg, url=MAVEN_FIXTURE_URL):
Expand All @@ -85,9 +85,9 @@ def populate_pulp(cfg, url=MAVEN_FIXTURE_URL):
sync(cfg, remote, repo)
finally:
if remote:
client.delete(remote["_href"])
client.delete(remote["pulp_href"])
if repo:
client.delete(repo["_href"])
client.delete(repo["pulp_href"])
return client.get(MAVEN_CONTENT_PATH)["results"]


Expand Down

0 comments on commit fce769c

Please sign in to comment.