From 3f79359fc173a8191a9be260ccbfef20d9728dc8 Mon Sep 17 00:00:00 2001 From: Robert Habermann <mail@rhab.de> Date: Sun, 24 Apr 2016 16:43:31 +0200 Subject: [PATCH] clean up headers --- pyotrs/lib.py | 1 - tests/test_article.py | 9 +++---- tests/test_attachment.py | 9 +++---- tests/test_client.py | 43 +++------------------------------- tests/test_dynamic_field.py | 9 +++---- tests/test_pyotrs_responses.py | 9 +++---- tests/test_session_id_store.py | 9 +++---- tests/test_ticket.py | 9 +++---- 8 files changed, 21 insertions(+), 77 deletions(-) diff --git a/pyotrs/lib.py b/pyotrs/lib.py index 91190b3..564fc93 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 f27e623..4c8c8cb 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 1bdb809..89f1713 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 052b039..eff3a9a 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 fc9854d..7ccc045 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 4dd364d..a125413 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 8de4403..4e77100 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 5d3ac29..af9afcd 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 -- GitLab