Skip to content

Commit

Permalink
Merge pull request #121 from Ichimonji10/bugzilla
Browse files Browse the repository at this point in the history
Reference bugs
  • Loading branch information
JacobCallahan committed Jun 18, 2015
2 parents 4eb614b + db3dff4 commit 38bef1f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
32 changes: 22 additions & 10 deletions nailgun/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -1276,13 +1276,8 @@ def create(self, create_missing=None):
def read(self, entity=None, attrs=None, ignore=()):
"""Deal with weirdly named data returned from the server.
When creating a domain, the server accepts a list named
``domain_parameters_attributes``. When reading a domain, the server
returns a list named ``parameters``. These appear to be the same data.
Deal with this naming weirdness.
Also, the server returns an entity ID instead of a hash of attributes
for the ``dns`` one to one field.
For more information, see `Bugzilla #1233245
<https://bugzilla.redhat.com/show_bug.cgi?id=1233245>`_.
"""
if attrs is None:
Expand Down Expand Up @@ -2334,8 +2329,8 @@ def list_rhproducts(self, per_page=None):
def create(self, create_missing=None):
"""Do extra work to fetch a complete set of attributes for this entity.
No value is returned for at least the "smart proxy" field, and possibly
other fields too.
For more information, see `Bugzilla #1230873
<https://bugzilla.redhat.com/show_bug.cgi?id=1230873>`_.
"""
return Organization(
Expand All @@ -2356,7 +2351,12 @@ def read(self, entity=None, attrs=None, ignore=('realm',)):
def update(self, fields=None):
"""Fetch a complete set of attributes for this entity.
FIXME: File a bug at https://bugzilla.redhat.com/ and link to it.
For more information, see `Bugzilla #1232871
<https://bugzilla.redhat.com/show_bug.cgi?id=1232871>`_.
Also, beware of `Bugzilla #1230865
<https://bugzilla.redhat.com/show_bug.cgi?id=1230865>`_:
"Cannot use HTTP PUT to associate organization with media"
"""
self.update_json(fields)
Expand Down Expand Up @@ -2745,6 +2745,18 @@ def __init__(self, server_config=None, **kwargs):
self._meta = {'api_path': 'api/v2/realms', 'server_modes': ('sat')}
super(Realm, self).__init__(server_config, **kwargs)

def create(self, create_missing=None):
"""Do extra work to fetch a complete set of attributes for this entity.
For more information, see `Bugzilla #1232855
<https://bugzilla.redhat.com/show_bug.cgi?id=1232855>`_.
"""
return Realm(
self._server_config,
id=self.create_json(create_missing)['id'],
).read()


class Report(Entity):
"""A representation of a Report entity."""
Expand Down
3 changes: 2 additions & 1 deletion tests/test_entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,12 +355,13 @@ def setUpClass(cls):
def test_generic(self):
"""Call ``create`` on a variety of entities."""
entities_ = (
entities.DockerComputeResource(self.cfg),
entities.AbstractDockerContainer(self.cfg),
entities.DockerComputeResource(self.cfg),
entities.Domain(self.cfg),
entities.Location(self.cfg),
entities.Media(self.cfg),
entities.Organization(self.cfg),
entities.Realm(self.cfg),
)
for entity in entities_:
with self.subTest(entity):
Expand Down

0 comments on commit 38bef1f

Please sign in to comment.