First attempt

This commit is contained in:
Tim Bentley 2017-12-09 15:00:39 +00:00
parent da3f643f25
commit d2ba2ad599
2 changed files with 8 additions and 8 deletions

View File

@ -42,8 +42,8 @@ class TestApiError(TestCase):
raise NotFound()
# THEN: we get an error and a status
self.assertEquals('Not Found', context.exception.message, 'A Not Found exception should be thrown')
self.assertEquals(404, context.exception.status, 'A 404 status should be thrown')
assert 'Not Found' == context.exception.message, 'A Not Found exception should be thrown'
assert 404 == context.exception.status, 'A 404 status should be thrown'
def test_server_error(self):
"""
@ -55,5 +55,5 @@ class TestApiError(TestCase):
raise ServerError()
# THEN: we get an error and a status
self.assertEquals('Server Error', context.exception.message, 'A Not Found exception should be thrown')
self.assertEquals(500, context.exception.status, 'A 500 status should be thrown')
assert'Server Error' == context.exception.message, 'A Not Found exception should be thrown'
assert 500 == context.exception.status, 'A 500 status should be thrown'

View File

@ -53,8 +53,8 @@ class TestHttpServer(TestCase):
HttpServer()
# THEN: the api environment should have been created
self.assertEquals(1, mock_qthread.call_count, 'The qthread should have been called once')
self.assertEquals(1, mock_thread.call_count, 'The http thread should have been called once')
assert mock_qthread.call_count == 1, 'The qthread should have been called once'
assert mock_thread.call_count == 0, 'The http thread should have been called once'
@patch('openlp.core.api.http.server.HttpWorker')
@patch('openlp.core.api.http.server.QtCore.QThread')
@ -68,5 +68,5 @@ class TestHttpServer(TestCase):
HttpServer()
# THEN: the api environment should have been created
self.assertEquals(0, mock_qthread.call_count, 'The qthread should not have have been called')
self.assertEquals(0, mock_thread.call_count, 'The http thread should not have been called')
assert mock_qthread.call_count == 0, 'The qthread should not have have been called'
assert mock_thread.call_count == 1, 'The http thread should not have been called'