mirror of
https://github.com/ejwa/gitinspector.git
synced 2024-11-16 08:38:26 +01:00
37 lines
1.3 KiB
Python
37 lines
1.3 KiB
Python
import unittest
|
|
from gitinspector import config
|
|
|
|
|
|
class TestConfig(unittest.TestCase):
|
|
|
|
def test_GitConfig_init(self):
|
|
expected_run = 'run'
|
|
expected_repo = 'repo'
|
|
expected_global_only = False
|
|
test_config = config.GitConfig(expected_run, expected_repo)
|
|
self.assertEqual(expected_run, test_config.run)
|
|
self.assertEqual(expected_repo, test_config.repo)
|
|
self.assertEqual(expected_global_only, test_config.global_only)
|
|
|
|
def test_read_git_config_unknown_variable(self):
|
|
expected_return_value = ''
|
|
test_config = config.GitConfig('arbitrary', '.')
|
|
actual_return_value = test_config.__read_git_config__('unknown')
|
|
self.assertEqual(expected_return_value, actual_return_value)
|
|
|
|
def test_read_git_config_string_unknown(self):
|
|
expected_return_value = (False, None)
|
|
test_config = config.GitConfig('arbitrary', '.')
|
|
actual_return_value = test_config.__read_git_config_string__('unknown')
|
|
self.assertEqual(expected_return_value, actual_return_value)
|
|
|
|
def test_read(self):
|
|
class Dummy():
|
|
pass
|
|
test_config = config.GitConfig(Dummy(), '.')
|
|
|
|
with self.assertRaises(AttributeError):
|
|
self.assertFalse(test_config.run.hard)
|
|
|
|
test_config.read()
|
|
self.assertFalse(test_config.run.hard)
|