summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2017-01-11 03:22:28 +0000
committerrsiddharth <s@ricketyspace.net>2017-01-11 03:22:28 +0000
commit80a69d5bf50f61b8a311c93b8474dc64e55e6fd0 (patch)
tree76bb964df02d0639a57b517a0312e85b3bf19208 /tests
parentd35105f158819f0f731a4efc7e138905ef8e627d (diff)
Make some tests mock $HOME
* tests/test_gd_diff.py: (test_read_config_file_fail, test_read_gns_readme, test_read_gns_readme_none): Update tests.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_gd_diff.py23
1 files changed, 13 insertions, 10 deletions
diff --git a/tests/test_gd_diff.py b/tests/test_gd_diff.py
index a8bac94..b4c0b6b 100644
--- a/tests/test_gd_diff.py
+++ b/tests/test_gd_diff.py
@@ -132,8 +132,9 @@ class TestGdDiff(object):
def test_read_config_file_fail(self):
- config = read_config_file()
- assert_equal(config, False)
+ with mock.patch('os.getenv', new=self.env_func):
+ config = read_config_file()
+ assert_equal(config, False)
def test_read_config_file_success(self):
@@ -309,18 +310,20 @@ class TestGdDiff(object):
def test_read_gns_readme(self):
- # first download the antlr readme
- saved = slurp_gns_readme('parkes', 'antlr')
- assert saved
+ with mock.patch('os.getenv', new=self.env_func):
+ # first download the antlr readme
+ saved = slurp_gns_readme('parkes', 'antlr')
+ assert saved
- antlr_readme_content = read_gns_readme('parkes', 'antlr')
- expected_antlr_readme_content = 'Changed-From-Debian: Removed example with non-free files.\nChange-Type: Modified\n\nFor gNewSense, the non-free unicode.IDENTs files are *actually* removed (see\nalso README.source). See gNewSense bug #34218 for details.\n'
- assert_equal(antlr_readme_content, expected_antlr_readme_content)
+ antlr_readme_content = read_gns_readme('parkes', 'antlr')
+ expected_antlr_readme_content = 'Changed-From-Debian: Removed example with non-free files.\nChange-Type: Modified\n\nFor gNewSense, the non-free unicode.IDENTs files are *actually* removed (see\nalso README.source). See gNewSense bug #34218 for details.\n'
+ assert_equal(antlr_readme_content, expected_antlr_readme_content)
def test_read_gns_readme_none(self):
- readme_content = read_gns_readme('parkes', 'non-existent-pkg')
- assert_equal(readme_content, None)
+ with mock.patch('os.getenv', new=self.env_func):
+ readme_content = read_gns_readme('parkes', 'non-existent-pkg')
+ assert_equal(readme_content, None)
def test_slurp_fields_from_readme(self):