config: implement tests suite.

This commit is contained in:
Jimmy Berry 2017-05-01 17:33:31 -05:00
parent 2f32bf8fbf
commit bb2678dc00
3 changed files with 33 additions and 0 deletions

28
tests/config_tests.py Normal file
View File

@ -0,0 +1,28 @@
import unittest
from osc import conf
from osclib.conf import Config
from osclib.stagingapi import StagingAPI
from obs import APIURL
from obs import OBS
PROJECT = 'openSUSE:Factory'
class TestConfig(unittest.TestCase):
def setUp(self):
self.obs = OBS()
self.config = Config(PROJECT)
def test_basic(self):
self.assertEqual('openSUSE', conf.config[PROJECT]['lock-ns'])
def test_remote(self):
self.assertEqual('local', conf.config[PROJECT]['overridden-by-local'])
self.assertIsNone(conf.config[PROJECT].get('remote-only'))
api = StagingAPI(APIURL, PROJECT)
self.config.apply_remote(api)
self.assertEqual('local', conf.config[PROJECT]['overridden-by-local'])
self.assertEqual('remote-indeed', conf.config[PROJECT]['remote-only'])

View File

@ -101,3 +101,6 @@ pass=opensuse
# User: mumblegack
# Force using of keyring for this API
#keyring = 1
[openSUSE:Factory]
overridden-by-local = local

View File

@ -0,0 +1,2 @@
overridden-by-local = remote-nope
remote-only = remote-indeed