Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_default(self):
"""
If it exists, use the file at $XDG_CONFIG_HOME/bugwarrior/bugwarriorrc
"""
rc = self.create('.config/bugwarrior/bugwarriorrc')
self.assertEqual(config.get_config_path(), rc)
def test_xdg_first(self):
"""
If both files above exist, the one in $XDG_CONFIG_HOME takes precedence
"""
self.create('.bugwarriorrc')
rc = self.create('.config/bugwarrior/bugwarriorrc')
self.assertEqual(config.get_config_path(), rc)
def test_no_file(self):
"""
If no bugwarriorrc exist anywhere, the path to the prefered one is
returned.
"""
self.assertEqual(
config.get_config_path(),
os.path.join(self.tempdir, '.config/bugwarrior/bugwarriorrc'))
def test_BUGWARRIORRC(self):
"""
If $BUGWARRIORRC is set, it takes precedence over everything else (even
if the file doesn't exist).
"""
rc = os.path.join(self.tempdir, 'my-bugwarriorc')
os.environ['BUGWARRIORRC'] = rc
self.create('.bugwarriorrc')
self.create('.config/bugwarrior/bugwarriorrc')
self.assertEqual(config.get_config_path(), rc)
def test_legacy(self):
"""
Falls back on .bugwarriorrc if it exists
"""
rc = self.create('.bugwarriorrc')
self.assertEqual(config.get_config_path(), rc)
def test_BUGWARRIORRC_empty(self):
"""
If $BUGWARRIORRC is set but emty, it is not used and the default file
is used instead.
"""
os.environ['BUGWARRIORRC'] = ''
rc = self.create('.config/bugwarrior/bugwarriorrc')
self.assertEqual(config.get_config_path(), rc)