This commit is contained in:
Mark Washenberger
2011-03-03 16:31:01 -05:00
parent 668cdc96b3
commit 9cfe8ff2e8
2 changed files with 8 additions and 7 deletions

View File

@@ -85,6 +85,7 @@ def _translate_detail_keys(inst):
return dict(server=inst_dict)
def _translate_keys(inst):
""" Coerces into dictionary format, excluding all model attributes
save for id and name """
@@ -143,8 +144,8 @@ class Controller(wsgi.Controller):
"""
Create a list of onset files from the personality request attribute
At this time, onset_files must be formatted as a list of
(file_path, file_content) pairs for compatibility with the
At this time, onset_files must be formatted as a list of
(file_path, file_content) pairs for compatibility with the
underlying compute service.
"""
onset_files = []
@@ -157,8 +158,8 @@ class Controller(wsgi.Controller):
try:
contents = base64.b64decode(contents)
except TypeError:
raise exc.HTTPBadRequest(explanation=
'Personality content for %s cannot be decoded' % path)
msg = 'Personality content for %s cannot be decoded' % path
raise exc.HTTPBadRequest(explanation=msg)
onset_files.append((path, contents))
return onset_files

View File

@@ -287,8 +287,8 @@ class ServersTest(test.TestCase):
request, response, onset_files = \
self._create_instance_with_personality(personality)
self.assertEquals(response.status_int, 200)
self.assertEquals(onset_files, [(path, contents)])
self.assertEquals(onset_files, [(path, contents)])
def test_create_instance_with_personality_with_non_b64_content(self):
path = '/my/file/path'
contents = '#!/bin/bash\necho "Oh no!"\n'
@@ -320,7 +320,7 @@ class ServersTest(test.TestCase):
request, response, onset_files = \
self._create_instance_with_personality(personality)
self.assertEquals(response.status_int, 200)
self.assertEquals(onset_files, [(path, contents)])
self.assertEquals(onset_files, [(path, contents)])
def test_create_instance_personality_not_a_list(self):
path = '/my/file/path'