[Kimchi-devel] [PATCH] fix whitespace in test_mockmodel
Aline Manera
alinefm at linux.vnet.ibm.com
Mon Dec 30 12:04:28 UTC 2013
On 12/27/2013 07:08 AM, shaohef at linux.vnet.ibm.com wrote:
> From: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
>
> Commit e467b32 brings a whitespace, fix it.
> Also fix pep8.
>
> Signed-off-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
> ---
> Makefile.am | 1 +
> tests/test_mockmodel.py | 24 +++++++++++++++---------
> 2 files changed, 16 insertions(+), 9 deletions(-)
>
> diff --git a/Makefile.am b/Makefile.am
> index 0fd92c8..1b51e46 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -48,6 +48,7 @@ PEP8_WHITELIST = \
> plugins/__init__.py \
> plugins/sample/__init__.py \
> plugins/sample/model.py \
> + tests/test_mockmodel.py \
> tests/test_plugin.py \
> $(NULL)
>
> diff --git a/tests/test_mockmodel.py b/tests/test_mockmodel.py
> index 5a3c73e..023567b 100644
> --- a/tests/test_mockmodel.py
> +++ b/tests/test_mockmodel.py
> @@ -18,7 +18,7 @@
> #
> # You should have received a copy of the GNU Lesser General Public
> # License along with this library; if not, write to the Free Software
> -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
>
> import cherrypy
> import json
> @@ -29,7 +29,7 @@ import unittest
>
> import kimchi.mockmodel
> import kimchi.controller
> -from utils import get_free_port, patch_auth, request, run_server
> +from utils import get_free_port, patch_auth, request, run_server
>
>
> #utils.silence_server()
I think we can remove the above comment
> @@ -38,6 +38,7 @@ model = None
> host = None
> port = None
>
> +
> class MockModelTests(unittest.TestCase):
> def setUp(self):
> global port, host, model, test_server
> @@ -99,19 +100,23 @@ class MockModelTests(unittest.TestCase):
> self.assertEquals(200, resp.status)
> self.assertEquals('image/png', resp.getheader('content-type'))
> resp1 = request(host, port, '/vms/test-vm')
> - rspBody=resp1.read()
> - testvm_Data=json.loads(rspBody)
> + rspBody = resp1.read()
> + testvm_Data = json.loads(rspBody)
> screenshotURL = testvm_Data['screenshot']
> time.sleep(5)
> resp2 = request(host, port, screenshotURL)
> self.assertEquals(200, resp2.status)
> - self.assertEquals(resp2.getheader('content-type'), resp.getheader('content-type'))
> - self.assertEquals(resp2.getheader('content-length'), resp.getheader('content-length'))
> - self.assertEquals(resp2.getheader('last-modified'), resp.getheader('last-modified'))
> + self.assertEquals(resp2.getheader('content-type'),
> + resp.getheader('content-type'))
> + self.assertEquals(resp2.getheader('content-length'),
> + resp.getheader('content-length'))
> + self.assertEquals(resp2.getheader('last-modified'),
> + resp.getheader('last-modified'))
>
> def test_vm_list_sorted(self):
> req = json.dumps({'name': 'test', 'cdrom': '/nonexistent.iso'})
> request(host, port, '/templates', req, 'POST')
> +
> def add_vm(name):
>
> # Create a VM
> @@ -126,8 +131,9 @@ class MockModelTests(unittest.TestCase):
> self.assertEqual(model.vms_get_list(), ['abc', 'bca', 'cab', 'xba'])
>
> def test_vm_info(self):
> - tmpl = model.templates_create({'name': u'test', 'cdrom': '/nonexistent.iso'})
> - vm = model.vms_create({'name': u'test', 'template': '/templates/test'})
> + model.templates_create({'name': u'test',
> + 'cdrom': '/nonexistent.iso'})
> + model.vms_create({'name': u'test', 'template': '/templates/test'})
> vms = model.vms_get_list()
> self.assertEquals(1, len(vms))
> self.assertEquals(u'test', vms[0])
More information about the Kimchi-devel
mailing list