Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Override create_payload and upload_payload for SmartVariable. #352

Merged
merged 1 commit into from
Jan 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions nailgun/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -4748,6 +4748,17 @@ def read(self, entity=None, attrs=None, ignore=None):
ignore.add('variable_type')
return super(SmartVariable, self).read(entity, attrs, ignore)

def create_payload(self):
"""Wrap submitted data within an extra dict."""
return {u'smart_variable': super(SmartVariable, self).create_payload()}

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


class Status(Entity):
"""A representation of a Status entity."""
Expand Down
2 changes: 2 additions & 0 deletions tests/test_entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@ def test_no_attributes(self):
entities.Media,
entities.OperatingSystem,
entities.Registry,
entities.SmartVariable,
entities.Subnet,
entities.User,
entities.UserGroup,
Expand Down Expand Up @@ -1223,6 +1224,7 @@ def test_generic(self):
(entities.Organization, {'organization': {}}),
(entities.Setting, {'setting': {}}),
(entities.SmartProxy, {'smart_proxy': {}}),
(entities.SmartVariable, {'smart_variable': {}}),
(entities.Subnet, {'subnet': {}}),
(entities.Registry, {'registry': {}}),
(entities.User, {'user': {}}),
Expand Down