diff options
author | Donne Martin <donne.martin@gmail.com> | 2019-02-17 06:53:41 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-17 06:53:41 -0500 |
commit | 53386f5c2b78cdafa70e2da7113a72432984f91e (patch) | |
tree | f96f6143ac22b2e1450904da316ea70c3b21d26d | |
parent | defa3ca7a03788dea78658954e75d15d57a1b824 (diff) |
Separate out integration tests from unit tests (#171)
-rw-r--r-- | tests/test_config.py | 17 | ||||
-rw-r--r-- | tests/test_config_integration.py | 48 |
2 files changed, 48 insertions, 17 deletions
diff --git a/tests/test_config.py b/tests/test_config.py index 781c3ef..d661966 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -21,7 +21,6 @@ import os from tests.compat import unittest from haxor_news.hacker_news import HackerNews -from haxor_news.settings import freelancer_post_id, who_is_hiring_post_id from tests.mock_hacker_news_api import MockHackerNewsApi @@ -48,22 +47,6 @@ class ConfigTest(unittest.TestCase): assert self.hn.config.item_cache == [] mock_save_cache.assert_called_with() - def test_load_hiring_and_freelance_ids(self): - self.hn.config.load_hiring_and_freelance_ids() - assert self.hn.config.hiring_id != who_is_hiring_post_id - assert self.hn.config.freelance_id != freelancer_post_id - - def test_load_hiring_and_freelance_ids_invalid_url(self): - self.hn.config.load_hiring_and_freelance_ids(url='https://example.com') - assert self.hn.config.hiring_id == who_is_hiring_post_id - assert self.hn.config.freelance_id == freelancer_post_id - os.remove('./downloaded_settings.py') - - def test_load_hiring_and_freelance_ids_from_cache_or_defaults(self): - self.hn.config.load_hiring_and_freelance_ids_from_cache_or_defaults() - assert self.hn.config.hiring_id == who_is_hiring_post_id - assert self.hn.config.freelance_id == freelancer_post_id - def test_save_and_load_item_ids(self): self.hn.config.item_ids = [0, 1, 2] self.hn.config.item_cache = [3, 4, 5] diff --git a/tests/test_config_integration.py b/tests/test_config_integration.py new file mode 100644 index 0000000..7f78097 --- /dev/null +++ b/tests/test_config_integration.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- + +# Copyright 2015 Donne Martin. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). You +# may not use this file except in compliance with the License. A copy of +# the License is located at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# or in the "license" file accompanying this file. This file 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 __future__ import print_function +from __future__ import division + +import os +from tests.compat import unittest + +from haxor_news.hacker_news import HackerNews +from haxor_news.settings import freelancer_post_id, who_is_hiring_post_id +from tests.mock_hacker_news_api import MockHackerNewsApi + + +class ConfigTestIntegration(unittest.TestCase): + + def setUp(self): + self.hn = HackerNews() + self.hn.hacker_news_api = MockHackerNewsApi() + self.limit = len(self.hn.hacker_news_api.items) + + def test_load_hiring_and_freelance_ids(self): + self.hn.config.load_hiring_and_freelance_ids() + assert self.hn.config.hiring_id != who_is_hiring_post_id + assert self.hn.config.freelance_id != freelancer_post_id + + def test_load_hiring_and_freelance_ids_invalid_url(self): + self.hn.config.load_hiring_and_freelance_ids(url='https://example.com') + assert self.hn.config.hiring_id == who_is_hiring_post_id + assert self.hn.config.freelance_id == freelancer_post_id + os.remove('./downloaded_settings.py') + + def test_load_hiring_and_freelance_ids_from_cache_or_defaults(self): + self.hn.config.load_hiring_and_freelance_ids_from_cache_or_defaults() + assert self.hn.config.hiring_id == who_is_hiring_post_id + assert self.hn.config.freelance_id == freelancer_post_id |