From 938ece97d7028fcd699fd47d6da4da40826b2194 Mon Sep 17 00:00:00 2001 From: jeorryb Date: Fri, 2 Dec 2016 09:16:40 -0500 Subject: [PATCH 1/9] Add patent.py and test_patent.py Initial commit, add patent.py add basic outline and test Add argparse section add **kwargs instead of positional arguments add class for Patent create config.py for constants add demo api key to config.py move patent.py beneath api folder add exception handling != 200 response Add docstring comments Delete patent.py Delete patent.py add mock import add unit tests for patent.py fix imports Delete patent.py Delete patent.py add mock import add unit tests for patent.py fix imports remove __int__ main fix PEP8 fix PEP8 add mock objects fix PEP8 --- pybluedot/api/__init__.py | 0 pybluedot/api/patent.py | 58 +++++++++++++++++++++++++++++ pybluedot/config.py | 3 ++ pybluedot/tests/unit/test_patent.py | 49 ++++++++++++++++++++++++ pybluedot/tests/unit/test_sample.py | 14 +++++++ 5 files changed, 124 insertions(+) create mode 100644 pybluedot/api/__init__.py create mode 100644 pybluedot/api/patent.py create mode 100644 pybluedot/config.py create mode 100644 pybluedot/tests/unit/test_patent.py diff --git a/pybluedot/api/__init__.py b/pybluedot/api/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/pybluedot/api/patent.py b/pybluedot/api/patent.py new file mode 100644 index 0000000..a6b82a0 --- /dev/null +++ b/pybluedot/api/patent.py @@ -0,0 +1,58 @@ +# Copyright 2016 Jeorry Balasabas +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from pybluedot import config +import requests + + +class Patent(object): + """A API to search NASA's patent repository. + + Args: + query (str, required): Search text to filter results. + api_key (str, required): api.nasa.gov key for expanded usage. + Default is DEMO_KEY in config.py. + concept_tags (str, optional): Return an ordered dict of concepts from + the patent abstract. Default is False. + limit (int, optional): Number of patents to return. Default is None. + """ + def __init__(self, query, api_key=config.API_KEY, concept_tags=False, + limit=None): + self.query = query + self.api_key = api_key + self.concept_tags = concept_tags + self.limit = limit + + def get(self): + """Builds parameter dict that requests library + will use for url query. + """ + self.patent_params = {'query': self.query, + 'api_key': self.api_key, + 'concept_tags': self.concept_tags, + 'limit': self.limit} + + response = requests.get(config.PATENT_URL, params=self.patent_params) + + try: + response.raise_for_status() + + except requests.exceptions.HTTPError as e: + return "Error: " + str(e) + + body = response.json() + + if 'error' in body: + raise Exception(body['error']) + return body diff --git a/pybluedot/config.py b/pybluedot/config.py new file mode 100644 index 0000000..25149db --- /dev/null +++ b/pybluedot/config.py @@ -0,0 +1,3 @@ + +PATENT_URL = 'https://api.nasa.gov/patents/content' +API_KEY = 'DEMO_KEY' diff --git a/pybluedot/tests/unit/test_patent.py b/pybluedot/tests/unit/test_patent.py new file mode 100644 index 0000000..501d96d --- /dev/null +++ b/pybluedot/tests/unit/test_patent.py @@ -0,0 +1,49 @@ +# Copyright 2016 Jeorry Balasabas +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import mock +from pybluedot.api import patent +from pybluedot.tests import base +import requests +from requests.exceptions import HTTPError + + +class PatentTestSuite(base.DietTestCase): + """This test suite provides some common things relevant to the + tests in this file. All tests should inherit from this class + """ + + def setUp(self): + """Perform setup activities + """ + self.testpatent = patent.Patent(query='plastic') + + @mock.patch('pybluedot.api.patent.requests.get', autospec=True) + def test_get_response_ok(self, mock_get): + mock_response = mock.Mock() + expected_dict = {'key': 'value'} + mock_response.json.return_value = expected_dict + mock_get.return_value = mock_response + response_dict = self.testpatent.get() + self.assertEqual(1, mock_response.json.call_count) + self.assertEqual(response_dict, expected_dict) + + @mock.patch('pybluedot.api.patent.requests.get', autospec=True) + def test_get_response_fail(self, mock_get): + mock_response = mock.Mock() + mock_response.status_code = 500 + mock_response.raise_for_status.side_effect = HTTPError('NASA API DOWN') + mock_get.return_value = mock_response + response = self.testpatent.get() + self.assertEqual(1, mock_response.raise_for_status.call_count) diff --git a/pybluedot/tests/unit/test_sample.py b/pybluedot/tests/unit/test_sample.py index fc2aad8..3863362 100644 --- a/pybluedot/tests/unit/test_sample.py +++ b/pybluedot/tests/unit/test_sample.py @@ -1,3 +1,17 @@ +# Copyright 2016 Jeorry Balasabas +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + from pybluedot.tests import base From 6ca6d1c958f7b1a4be88e3bcf5f98e744208b0ab Mon Sep 17 00:00:00 2001 From: jeorryb Date: Mon, 9 Jan 2017 14:34:43 -0500 Subject: [PATCH 2/9] update unit tests --- pybluedot/api/patent.py | 5 +++-- pybluedot/tests/unit/test_patent.py | 22 +++++++++++++++------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/pybluedot/api/patent.py b/pybluedot/api/patent.py index a6b82a0..e2d78d3 100644 --- a/pybluedot/api/patent.py +++ b/pybluedot/api/patent.py @@ -14,6 +14,7 @@ from pybluedot import config import requests +from requests.exceptions import HTTPError class Patent(object): @@ -48,8 +49,8 @@ def get(self): try: response.raise_for_status() - except requests.exceptions.HTTPError as e: - return "Error: " + str(e) + except HTTPError as e: + raise HTTPError(str(e)) body = response.json() diff --git a/pybluedot/tests/unit/test_patent.py b/pybluedot/tests/unit/test_patent.py index 501d96d..24e0cce 100644 --- a/pybluedot/tests/unit/test_patent.py +++ b/pybluedot/tests/unit/test_patent.py @@ -15,7 +15,6 @@ import mock from pybluedot.api import patent from pybluedot.tests import base -import requests from requests.exceptions import HTTPError @@ -31,7 +30,7 @@ def setUp(self): @mock.patch('pybluedot.api.patent.requests.get', autospec=True) def test_get_response_ok(self, mock_get): - mock_response = mock.Mock() + mock_response = mock.MagicMock() expected_dict = {'key': 'value'} mock_response.json.return_value = expected_dict mock_get.return_value = mock_response @@ -40,10 +39,19 @@ def test_get_response_ok(self, mock_get): self.assertEqual(response_dict, expected_dict) @mock.patch('pybluedot.api.patent.requests.get', autospec=True) - def test_get_response_fail(self, mock_get): - mock_response = mock.Mock() - mock_response.status_code = 500 + def test_get_response_raises_HTTPError(self, mock_get): + mock_response = mock.MagicMock() + mock_response.status_code.return_value = 500 mock_response.raise_for_status.side_effect = HTTPError('NASA API DOWN') mock_get.return_value = mock_response - response = self.testpatent.get() - self.assertEqual(1, mock_response.raise_for_status.call_count) + with self.assertRaises(HTTPError): + self.testpatent.get() + + @mock.patch('pybluedot.api.patent.requests.get', autospec=True) + def test_get_response_error_in_body(self, mock_get): + mock_response = mock.MagicMock() + mock_body = {'error': 'there is something wrong'} + mock_response.json.return_value = mock_body + mock_get.return_value = mock_response + with self.assertRaises(Exception): + self.testpatent.get() From 81e9bb048b66e32c53fe5b43eca8b11e4ec07a83 Mon Sep 17 00:00:00 2001 From: jeorryb Date: Mon, 9 Jan 2017 14:47:04 -0500 Subject: [PATCH 3/9] update unit test with ValueError exception --- pybluedot/api/patent.py | 2 +- pybluedot/tests/unit/test_patent.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pybluedot/api/patent.py b/pybluedot/api/patent.py index e2d78d3..97c5747 100644 --- a/pybluedot/api/patent.py +++ b/pybluedot/api/patent.py @@ -55,5 +55,5 @@ def get(self): body = response.json() if 'error' in body: - raise Exception(body['error']) + raise ValueError(body['error']) return body diff --git a/pybluedot/tests/unit/test_patent.py b/pybluedot/tests/unit/test_patent.py index 24e0cce..dceca0d 100644 --- a/pybluedot/tests/unit/test_patent.py +++ b/pybluedot/tests/unit/test_patent.py @@ -53,5 +53,5 @@ def test_get_response_error_in_body(self, mock_get): mock_body = {'error': 'there is something wrong'} mock_response.json.return_value = mock_body mock_get.return_value = mock_response - with self.assertRaises(Exception): + with self.assertRaises(ValueError): self.testpatent.get() From 169acf1edf32f7e78a4a07a99464b7d16a82839d Mon Sep 17 00:00:00 2001 From: jeorryb Date: Mon, 9 Jan 2017 23:49:32 -0500 Subject: [PATCH 4/9] add APOD_URL --- pybluedot/api/apod.py | 57 +++++++++++++++++++++++++++++++++++++++++++ pybluedot/config.py | 1 + 2 files changed, 58 insertions(+) create mode 100644 pybluedot/api/apod.py diff --git a/pybluedot/api/apod.py b/pybluedot/api/apod.py new file mode 100644 index 0000000..722c270 --- /dev/null +++ b/pybluedot/api/apod.py @@ -0,0 +1,57 @@ +# Copyright 2016 Jeorry Balasabas +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from datetime import date +from pybluedot import config +import requests +from requests.exceptions import HTTPError + +class Apod(object): + """A API to return NASA's astronomy picture of the day. + + Args: + date (str, optional): The date of the APOD image to retrieve. + format YYYY-MM-DD + Default is today's date. + dh (bool, optional): Retrieve url for for high res image. + api_key (str, required): api.nasa.gov key for expanded usage. + Default is DEMO_KEY in config.py. + """ + + def __init__(self, date=None, api_key=config.API_KEY, hd=False): + self.date = date + self.api_key = api_key + self.hd = hd + + def get(self): + """Builds parameter dict that requests library + will use for url query. + """ + self.patent_params = {'date': self.date, + 'api_key': self.api_key, + 'hd': self.hd} + + response = requests.get(config.APOD_URL, params=self.patent_params) + + try: + response.raise_for_status() + + except HTTPError as e: + raise HTTPError(str(e)) + + body = response.json() + + if 'error' in body: + raise ValueError(body['error']) + return body diff --git a/pybluedot/config.py b/pybluedot/config.py index 25149db..40b5dd4 100644 --- a/pybluedot/config.py +++ b/pybluedot/config.py @@ -1,3 +1,4 @@ PATENT_URL = 'https://api.nasa.gov/patents/content' +APOD_URL = 'https://api.nasa.gov/planetary/apod' API_KEY = 'DEMO_KEY' From 4f8f51baffae887b5be5bebc7932e84a417e7fce Mon Sep 17 00:00:00 2001 From: jeorryb Date: Mon, 9 Jan 2017 23:55:40 -0500 Subject: [PATCH 5/9] add PEP8 --- pybluedot/api/apod.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pybluedot/api/apod.py b/pybluedot/api/apod.py index 722c270..523312f 100644 --- a/pybluedot/api/apod.py +++ b/pybluedot/api/apod.py @@ -12,11 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -from datetime import date from pybluedot import config import requests from requests.exceptions import HTTPError + class Apod(object): """A API to return NASA's astronomy picture of the day. From fca5ae3cfb311a8a935750acfcee976c33a756fa Mon Sep 17 00:00:00 2001 From: jeorryb Date: Mon, 9 Jan 2017 23:59:37 -0500 Subject: [PATCH 6/9] add PEP8 --- pybluedot/tests/base.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pybluedot/tests/base.py b/pybluedot/tests/base.py index 0a299e8..e2f23c4 100644 --- a/pybluedot/tests/base.py +++ b/pybluedot/tests/base.py @@ -1,3 +1,17 @@ +# Copyright 2016 Jeorry Balasabas +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + import unittest From 465a0abf4133b7d2349b8b92e62fe2a9534a85db Mon Sep 17 00:00:00 2001 From: jeorryb Date: Thu, 22 Jun 2017 13:29:25 -0400 Subject: [PATCH 7/9] refactor using base.py --- pybluedot/.DS_Store | Bin 0 -> 6148 bytes pybluedot/api/.DS_Store | Bin 0 -> 6148 bytes pybluedot/api/apod.py | 19 ------------ pybluedot/api/base.py | 35 +++++++++++++++++++++ pybluedot/commands.py | 41 ------------------------- pybluedot/config.py | 4 --- pybluedot/pybdotconfig.py | 49 ++++++++++++++++++++++++++++++ pybluedot/pybluedotconf.py | 33 ++++++++++++++++++++ pybluedot/tests/.DS_Store | Bin 0 -> 6148 bytes pybluedot/tests/unit/.DS_Store | Bin 0 -> 6148 bytes pybluedot/tests/unit/test_apod.py | 42 +++++++++++++++++++++++++ 11 files changed, 159 insertions(+), 64 deletions(-) create mode 100644 pybluedot/.DS_Store create mode 100644 pybluedot/api/.DS_Store create mode 100644 pybluedot/api/base.py delete mode 100644 pybluedot/commands.py delete mode 100644 pybluedot/config.py create mode 100644 pybluedot/pybdotconfig.py create mode 100644 pybluedot/pybluedotconf.py create mode 100644 pybluedot/tests/.DS_Store create mode 100644 pybluedot/tests/unit/.DS_Store create mode 100644 pybluedot/tests/unit/test_apod.py diff --git a/pybluedot/.DS_Store b/pybluedot/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..ea75f597d51d2ca0fd050e6198c25b11371cfcd2 GIT binary patch literal 6148 zcmeHK&1%~~5Z<+&Mz$|1Z6VOhUJE|h`K33-O^*SCicM*XD^;Ri5R$Rvm|_e%=P~-1 zzCzBSeTP0uZkgGg1RJ;4)|44B`_0bItfX(nu0{wUyVIy6ge!z_KoKi-XnrF&j=Cll z^3(t&&XJG9BnzQ;6OPxS*|CWX;M!G1AjU$6v*q~ z{wSOIMNmxhZZLUcdOC_jvU@=>y0c$pS#oa&VPD6yq5JqnmKK3dJKsP@#c1e0=}qEuNbLn_+}F7db)t)pP93kIyEC8f9X@ZV&hGA_rRGOR?Uvf# zJ6tT>E5~{I?BMwH^>}gd>GPMb-!8vj|FCNy;d3?ei0}@6f^W|U|VPOWC0cK#c8K6zjX>Rso^3yQ`%)mcj0QUz4is%uR7R}ZH zjVS>D@i)>4*jP(ojw193ON%f9B5f+5O_fw)NSh9RMR6WsY0;(&NyUexJ4>oiq`5oH zuS~d*o<(k%0cK#8fvWAgc>cfqbN#=X#64z!8ThXlkhK&4qzkV^XY1O_;aRId-+`iF oTxsz>1q^c(Lo6P}JD^6uuh0PW2uq9L0pTA3LjyO=z+YwH7U~CWM*si- literal 0 HcmV?d00001 diff --git a/pybluedot/api/.DS_Store b/pybluedot/api/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0#D|B88S?>8-0+3(%j0}K-S1Z~(iR=?ls;mzpWA{IkOERb3P=Gd zFe3%>7+FOW6aI$5DvP7ju? z7GsFlqn#{yT}`&m-VV#*!}8ANQw+^|JFGCFSq&&i0Vyz1VA=E0&;JAczxjXCqEre< zfj3jYhW+P$$Ct{p_0Q{h{g_o>H#!-YGyM7qVB$ydh91WK;tR4STPG_t{Ro5%3R2*u G3j6@ZOA^HZ literal 0 HcmV?d00001 diff --git a/pybluedot/tests/unit/.DS_Store b/pybluedot/tests/unit/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 Date: Wed, 12 Jul 2017 09:47:35 -0400 Subject: [PATCH 8/9] refactor patent --- .gitignore | 3 ++ pybluedot/pybluedotconf.py => pybdot.ini | 4 +- pybluedot/.DS_Store | Bin 6148 -> 0 bytes pybluedot/__init__.py | 1 + pybluedot/api/.DS_Store | Bin 6148 -> 0 bytes pybluedot/api/base.py | 58 +++++++++++++---------- pybluedot/api/patent.py | 54 ++++++--------------- pybluedot/pybdot.ini | 33 +++++++++++++ pybluedot/pybdotconfig.py | 14 ++++-- pybluedot/tests/.DS_Store | Bin 6148 -> 0 bytes pybluedot/tests/unit/.DS_Store | Bin 6148 -> 0 bytes 11 files changed, 96 insertions(+), 71 deletions(-) rename pybluedot/pybluedotconf.py => pybdot.ini (89%) delete mode 100644 pybluedot/.DS_Store delete mode 100644 pybluedot/api/.DS_Store create mode 100644 pybluedot/pybdot.ini delete mode 100644 pybluedot/tests/.DS_Store delete mode 100644 pybluedot/tests/unit/.DS_Store diff --git a/.gitignore b/.gitignore index 3d465db..b8025bf 100644 --- a/.gitignore +++ b/.gitignore @@ -90,3 +90,6 @@ ENV/ # Rope project settings .ropeproject + +#OSX stuff +.DS_Store diff --git a/pybluedot/pybluedotconf.py b/pybdot.ini similarity index 89% rename from pybluedot/pybluedotconf.py rename to pybdot.ini index 371cebc..1d8ce80 100644 --- a/pybluedot/pybluedotconf.py +++ b/pybdot.ini @@ -1,7 +1,7 @@ [Global] -api_key = DEMO_KEY +api_key = aApglMV0QO74TpuZACRnSUvGel8ayxf7Z067Nnsa -[Patent] +[PATENT] url = https://api.nasa.gov/patents/content [APOD] diff --git a/pybluedot/.DS_Store b/pybluedot/.DS_Store deleted file mode 100644 index ea75f597d51d2ca0fd050e6198c25b11371cfcd2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK&1%~~5Z<+&Mz$|1Z6VOhUJE|h`K33-O^*SCicM*XD^;Ri5R$Rvm|_e%=P~-1 zzCzBSeTP0uZkgGg1RJ;4)|44B`_0bItfX(nu0{wUyVIy6ge!z_KoKi-XnrF&j=Cll z^3(t&&XJG9BnzQ;6OPxS*|CWX;M!G1AjU$6v*q~ z{wSOIMNmxhZZLUcdOC_jvU@=>y0c$pS#oa&VPD6yq5JqnmKK3dJKsP@#c1e0=}qEuNbLn_+}F7db)t)pP93kIyEC8f9X@ZV&hGA_rRGOR?Uvf# zJ6tT>E5~{I?BMwH^>}gd>GPMb-!8vj|FCNy;d3?ei0}@6f^W|U|VPOWC0cK#c8K6zjX>Rso^3yQ`%)mcj0QUz4is%uR7R}ZH zjVS>D@i)>4*jP(ojw193ON%f9B5f+5O_fw)NSh9RMR6WsY0;(&NyUexJ4>oiq`5oH zuS~d*o<(k%0cK#8fvWAgc>cfqbN#=X#64z!8ThXlkhK&4qzkV^XY1O_;aRId-+`iF oTxsz>1q^c(Lo6P}JD^6uuh0PW2uq9L0pTA3LjyO=z+YwH7U~CWM*si- diff --git a/pybluedot/__init__.py b/pybluedot/__init__.py index e69de29..bdcf8bd 100644 --- a/pybluedot/__init__.py +++ b/pybluedot/__init__.py @@ -0,0 +1 @@ +from .api.patent import Patent \ No newline at end of file diff --git a/pybluedot/api/.DS_Store b/pybluedot/api/.DS_Store deleted file mode 100644 index 5008ddfcf53c02e82d7eee2e57c38e5672ef89f6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0#D|B88S?>8-0+3(%j0}K-S1Z~(iR=?ls;mzpWA{IkOERb3P=Gd zFe3%>7+FOW6aI$5DvP7ju? z7GsFlqn#{yT}`&m-VV#*!}8ANQw+^|JFGCFSq&&i0Vyz1VA=E0&;JAczxjXCqEre< zfj3jYhW+P$$Ct{p_0Q{h{g_o>H#!-YGyM7qVB$ydh91WK;tR4STPG_t{Ro5%3R2*u G3j6@ZOA^HZ diff --git a/pybluedot/tests/unit/.DS_Store b/pybluedot/tests/unit/.DS_Store deleted file mode 100644 index 5008ddfcf53c02e82d7eee2e57c38e5672ef89f6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 Date: Wed, 12 Jul 2017 09:57:57 -0400 Subject: [PATCH 9/9] remove apod unit test --- pybluedot/tests/unit/test_apod.py | 42 ------------------------------- 1 file changed, 42 deletions(-) delete mode 100644 pybluedot/tests/unit/test_apod.py diff --git a/pybluedot/tests/unit/test_apod.py b/pybluedot/tests/unit/test_apod.py deleted file mode 100644 index 4b46ead..0000000 --- a/pybluedot/tests/unit/test_apod.py +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright 2016 Jeorry Balasabas -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import mock -from pybluedot.api import apod -from pybluedot.tests import base -from requests.exceptions import HTTPError - - -@mock.patch('pybluedot.api.apod.requests.get', autospec=True) -class ApodTestSuite(base.DietTestCase): - """This test suite provides some common things relevant to the - tests in this file. All tests should inherit from this class - """ - -def setUp(self): - """Perform setup activities - """ - self.testapod = apod.Apod() - - def test_get_response_ok(self, mock_get): - mock_response = mock.MagicMock() - expected_dict = {'key': 'value'} - mock_response.json.return_value = expected_dict - mock_get.return_value = mock_response - response_dict = self.testapod.get() - self.assertEqual(1, mock_response.json.call_count) - self.assertEqual(response_dict, expected_dict) - - def test_get_response_raises_HTTPError(self, mock_get): -