diff --git a/pyotrs/lib.py b/pyotrs/lib.py index 91190b33383dd4b2e0eab4584e7e65de489a9b83..564fc93b746f28fc5c134306d8b090d668599e05 100644 --- a/pyotrs/lib.py +++ b/pyotrs/lib.py @@ -5,7 +5,6 @@ from __future__ import unicode_literals # support both Python2 and 3 PyOTRS lib This code implements the PyOTRS library to provide access to the OTRS API (REST) - """ import os diff --git a/tests/test_article.py b/tests/test_article.py index f27e623dcf41f84a52ab1d181cd325dc999652af..4c8c8cb8342e87f2f5c33030a562d7ef5c7acf3a 100644 --- a/tests/test_article.py +++ b/tests/test_article.py @@ -1,12 +1,9 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals # support both Python2 and 3 -# -# Name: test_article.py -# Description: Test for PyOTRS Article class -# -# Author: robert.habermann@dlh.de -# Date: 2016-04-17 +""" test_article.py +Test for PyOTRS Article class +""" # make sure (early) that parent dir (main app) is in path import os.path diff --git a/tests/test_attachment.py b/tests/test_attachment.py index 1bdb809a680aab97e1148fdefa6020779561e814..89f1713458fc0d5d37865f9b6cb7ada4a92d4d3b 100644 --- a/tests/test_attachment.py +++ b/tests/test_attachment.py @@ -1,12 +1,9 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals # support both Python2 and 3 -# -# Name: test_attachment.py -# Description: Test for PyOTRS Attachment class -# -# Author: robert.habermann@dlh.de -# Date: 2016-04-18 +""" test_attachment.py +Test for PyOTRS Attachment class +""" # make sure (early) that parent dir (main app) is in path import os.path diff --git a/tests/test_client.py b/tests/test_client.py index 052b039aedf37800af596b805038bd5bf7cac9f4..eff3a9a5b3b668f7fed7b23ddd945dcb30981875 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -1,12 +1,9 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals # support both Python2 and 3 -# -# Name: test_client.py -# Description: Test for PyOTRS Client class -# -# Author: robert.habermann@dlh.de -# Date: 2016-04-18 +""" test_client.py +Test for PyOTRS Client class +""" # make sure (early) that parent dir (main app) is in path import unittest2 as unittest @@ -473,31 +470,8 @@ class ClientTests(unittest.TestCase): obj.ticket_create(ticket=tic, article=art, dynamic_field_list=[dyn1, dyn2]) self.assertEqual(mock_t_create_json.call_count, 1) - # @mock.patch('pyotrs.lib.requests.Response.json', autospec=True) - # @mock.patch('pyotrs.lib.Client._parse_and_validate_response', autospec=True) - # def test__ticket_create_json_mocked(self, mock_validate_resp, mock_response_json): - # """Test _ticket_create_json - mocked""" - # obj = Client(baseurl="http://fqdn", - # webservicename="GenericTicketConnectorREST") - # - # def mock_response_obj(): - # return True - # - # mock_validate_resp.return_value = True - # mock_response_json.return_value = {} - # - # with mock.patch.object(obj, '_send_request') as mock_send_request: - # mock_send_request.return_value = requests.Response - # result = obj._ticket_create_json(url="http://localhost", payload={"bar": "rab"}) - # - # self.assertEqual(result, True) - # self.assertEqual(obj.operation, 'TicketCreate') - # self.assertEqual(obj.http_method, 'POST') - # self.assertEqual(mock_validate_resp.call_count, 1) - def test_ticket_search_nothing_to_look_for(self): """Tests ticket_search nothing to look for""" - # create object obj = Client(baseurl="http://fqdn", webservicename="GenericTicketConnectorREST") self.assertRaisesRegex(TicketSearchNothingToLookFor, 'Nothing specified to look for!', @@ -506,7 +480,6 @@ class ClientTests(unittest.TestCase): @mock.patch('pyotrs.Client._ticket_search_json', autospec=True) def test_ticket_search_ticket_id(self, mock_ticket_search_json): """Tests ticket_search ticket id""" - # create object obj = Client(baseurl="http://fqdn", webservicename="GenericTicketConnectorREST") obj.ticket_search_result_list = [1] mock_ticket_search_json.return_value = True @@ -518,7 +491,6 @@ class ClientTests(unittest.TestCase): @mock.patch('pyotrs.Client._ticket_search_json', autospec=True) def test_ticket_search_datetime(self, mock_ticket_search_json): """Tests ticket_search datetime""" - # create object obj = Client(baseurl="http://fqdn", webservicename="GenericTicketConnectorREST") obj.ticket_search_result_list = [1] mock_ticket_search_json.return_value = True @@ -530,7 +502,6 @@ class ClientTests(unittest.TestCase): @mock.patch('pyotrs.Client.ticket_search') def test_ticket_search_full_text(self, mock_ticket_search): """Tests ticket_search full text""" - # create object obj = Client(baseurl="http://fqdn", webservicename="GenericTicketConnectorREST") obj.ticket_search_result_list = [1] @@ -555,7 +526,6 @@ class ClientTests(unittest.TestCase): @mock.patch('pyotrs.Client._ticket_update_json', autospec=True) def test_ticket_update_queue_id_ok(self, mock_ticket_update_json): """Tests ticket_update queue_id ok""" - # create object obj = Client(baseurl="http://fqdn", webservicename="GenericTicketConnectorREST") mock_ticket_update_json.return_value = True @@ -566,7 +536,6 @@ class ClientTests(unittest.TestCase): @mock.patch('pyotrs.Client._ticket_update_json', autospec=True) def test_ticket_update_queue_id_nok(self, mock_ticket_update_json): """Tests ticket_update queue_id nok""" - # create object obj = Client(baseurl="http://fqdn", webservicename="GenericTicketConnectorREST") mock_ticket_update_json.return_value = False @@ -691,7 +660,6 @@ class ClientTests(unittest.TestCase): @mock.patch('pyotrs.Client._ticket_update_json', autospec=True) def test_ticket_update_set_pending_nok(self, mock_ticket_update_json): """Tests ticket_update_set_pending nok""" - # create object obj = Client(baseurl="http://fqdn", webservicename="GenericTicketConnectorREST") mock_ticket_update_json.return_value = False @@ -768,10 +736,6 @@ class ClientTests(unittest.TestCase): """Test _validate_response_init_invalid - missing response """ client = Client(baseurl="http://localhost", webservicename="foo") - # mocked_response = mock.Mock(spec=requests.Response) - # mocked_response.status_code = 200 - # mocked_response.json.return_value = {} - self.assertRaisesRegex(ValueError, 'requests.Response object expected!', client._parse_and_validate_response, @@ -841,7 +805,6 @@ class ClientTests(unittest.TestCase): client._parse_and_validate_response(mocked_response) self.assertEqual(client.response_type, 'TicketID') - # self.assertEqual(mocked_response_json.call_count, 1) self.assertDictEqual(client.response_json, {u'ArticleID': u'26', u'TicketID': u'9', u'TicketNumber': u'000008'}) diff --git a/tests/test_dynamic_field.py b/tests/test_dynamic_field.py index fc9854dd0d65a052abfe292e9a3a39b2cc764cd6..7ccc045e2df6c95a10111aaed572cfaf13500e6f 100644 --- a/tests/test_dynamic_field.py +++ b/tests/test_dynamic_field.py @@ -1,12 +1,9 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals # support both Python2 and 3 -# -# Name: test_dynamic_field.py -# Description: Test for PyOTRS DynamicField class -# -# Author: robert.habermann@dlh.de -# Date: 2016-04-18 +""" test_dynamic_field.py +Test for PyOTRS DynamicField class +""" # make sure (early) that parent dir (main app) is in path import os.path diff --git a/tests/test_pyotrs_responses.py b/tests/test_pyotrs_responses.py index 4dd364da5ebde4ced8617ecb1a6b564551277f8e..a125413fef5e5d1347234ba0e58d62e56cff8069 100644 --- a/tests/test_pyotrs_responses.py +++ b/tests/test_pyotrs_responses.py @@ -1,12 +1,9 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals # support both Python2 and 3 -# -# Name: test_pyotrs_responses.py -# Description: Test for pyotrs module -# -# Author: robert.habermann@dlh.de -# Date: 2015-07-14 +""" test_pyotrs_responses.py +Test for PyOTRS using **responses** +""" # make sure (early) that parent dir (main app) is in path import unittest2 as unittest diff --git a/tests/test_session_id_store.py b/tests/test_session_id_store.py index 8de44030d5060066399329cc9651ff5c43bf7827..4e771005e1b02dbf891d31595ff52962151d71ea 100644 --- a/tests/test_session_id_store.py +++ b/tests/test_session_id_store.py @@ -1,12 +1,9 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals # support both Python2 and 3 -# -# Name: test_session_id_store.py -# Description: Test for PyOTRS Client class -# -# Author: robert.habermann@dlh.de -# Date: 2016-04-23 +""" test_session_id_store.py +Test for PyOTRS Client class +""" # make sure (early) that parent dir (main app) is in path import unittest2 as unittest diff --git a/tests/test_ticket.py b/tests/test_ticket.py index 5d3ac292e4e0e917abaac723082ba0dbdd4a8bca..af9afcdf9c2eccaadbf6a96ea5b866ca0d6e7c7d 100644 --- a/tests/test_ticket.py +++ b/tests/test_ticket.py @@ -1,12 +1,9 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals # support both Python2 and 3 -# -# Name: test_ticket.py -# Description: Test for PyOTRS Ticket class -# -# Author: robert.habermann@dlh.de -# Date: 2016-04-18 +""" test_ticket.py +Test for PyOTRS Ticket class +""" # make sure (early) that parent dir (main app) is in path import os.path