Skip to content

Commit

Permalink
First argument of assertEqual should be the expected value.
Browse files Browse the repository at this point in the history
  • Loading branch information
Timo Stollenwerk committed Feb 24, 2015
1 parent 2727358 commit cf31f8f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
16 changes: 8 additions & 8 deletions src/plonetraining/testing/tests/test_browser_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_view_html_structure(self):
view = getMultiAdapter((self.task, self.request), name="view")
view = view.__of__(self.task)
output = lxml.html.fromstring(view())
self.assertEqual(len(output.xpath("/html/body/div")), 1)
self.assertEqual(1, len(output.xpath("/html/body/div")))


class TaskViewWithBrowserlayerIntegrationTest(unittest.TestCase):
Expand Down Expand Up @@ -135,15 +135,15 @@ def test_view_json(self):
view = view.__of__(self.task)

self.assertEqual(
json.loads(view()),
{
u'title': u'Task',
u'description': u''
}
},
json.loads(view())
)
self.assertEqual(
'application/json; charset=utf-8',
view.request.response.headers.get('content-type'),
'application/json; charset=utf-8'
)


Expand Down Expand Up @@ -173,8 +173,8 @@ def test_view_json(self):
self.assertEqual(len(output.xpath("/task/description")), 1)
self.assertEqual(output.xpath("/task/description")[0].text, None)
self.assertEqual(
view.request.response.headers.get('content-type'),
'application/xml; charset=utf-8'
'application/xml; charset=utf-8',
view.request.response.headers.get('content-type')
)


Expand All @@ -199,6 +199,6 @@ def test_view_redirect(self):
view()

self.assertEqual(
self.request.response.headers['location'],
'http://nohost/plone'
'http://nohost/plone',
self.request.response.headers['location']
)
4 changes: 0 additions & 4 deletions src/plonetraining/testing/tests/test_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,9 @@ class TestInstall(unittest.TestCase):

def setUp(self):
"""Custom shared utility setup for tests."""
print('\n ---> setUp \n')
self.portal = self.layer['portal']
self.installer = api.portal.get_tool('portal_quickinstaller')

def tearDown(self):
print('\n ---> tearDown \n')

def test_product_installed(self):
"""Test if plonetraining.testing is installed with portal_quickinstaller."""
self.assertTrue(self.installer.isProductInstalled('plonetraining.testing'))
Expand Down
2 changes: 1 addition & 1 deletion src/plonetraining/testing/tests/test_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ def test_add_task(self):
self.browser.getControl("Save").click()

self.assertEqual(
"My Task",
self.portal['my-task'].title,
"My Task"
)

def test_view_task(self):
Expand Down

0 comments on commit cf31f8f

Please sign in to comment.