Skip to content

Commit

Permalink
Add entities.PartitionTable.update()
Browse files Browse the repository at this point in the history
Added ```entities.PartitionTable.update()```, as it's needed for SatelliteQE/robottelo#2502.
Part of SatelliteQE#111.
  • Loading branch information
Andrii Balakhtar committed Jul 1, 2015
1 parent e246cb5 commit 19fb604
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 16 additions & 1 deletion nailgun/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -2759,7 +2759,11 @@ def repository_sets_available_repositories(self, reposet_id):


class PartitionTable(
Entity, EntityCreateMixin, EntityDeleteMixin, EntityReadMixin):
Entity,
EntityCreateMixin,
EntityDeleteMixin,
EntityReadMixin,
EntityUpdateMixin):
"""A representation of a Partition Table entity."""

def __init__(self, server_config=None, **kwargs):
Expand All @@ -2774,6 +2778,17 @@ def __init__(self, server_config=None, **kwargs):
self._meta = {'api_path': 'api/v2/ptables', 'server_modes': ('sat')}
super(PartitionTable, self).__init__(server_config, **kwargs)

def update(self, fields=None):
"""Fetch a complete set of attributes for this entity."""
self.update_json(fields)
return self.read()

def update_payload(self, fields=None):
"""Wrap submitted data within an extra dict."""
return {
u'ptable': super(PartitionTable, self).update_payload(fields)
}


class PuppetClass(
Entity, EntityCreateMixin, EntityDeleteMixin, EntityReadMixin):
Expand Down
2 changes: 2 additions & 0 deletions tests/test_entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,7 @@ def test_generic(self):
entities.HostGroup(self.cfg),
entities.Location(self.cfg),
entities.Organization(self.cfg),
entities.PartitionTable(self.cfg),
entities.User(self.cfg),
)
for entity in entities_:
Expand Down Expand Up @@ -893,6 +894,7 @@ def test_generic(self):
(entities.HostGroup, {'hostgroup': {}}),
(entities.Location, {'location': {}}),
(entities.Organization, {'organization': {}}),
(entities.PartitionTable, {'ptable': {}}),
(entities.User, {'user': {}}),
]
for klass, response in class_response:
Expand Down

0 comments on commit 19fb604

Please sign in to comment.