config: implement tests suite.
This commit is contained in:
parent
2f32bf8fbf
commit
bb2678dc00
28
tests/config_tests.py
Normal file
28
tests/config_tests.py
Normal 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'])
|
3
tests/fixtures/oscrc
vendored
3
tests/fixtures/oscrc
vendored
@ -101,3 +101,6 @@ pass=opensuse
|
||||
# User: mumblegack
|
||||
# Force using of keyring for this API
|
||||
#keyring = 1
|
||||
|
||||
[openSUSE:Factory]
|
||||
overridden-by-local = local
|
||||
|
2
tests/fixtures/source/openSUSE:Factory:Staging/dashboard/config
vendored
Normal file
2
tests/fixtures/source/openSUSE:Factory:Staging/dashboard/config
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
overridden-by-local = remote-nope
|
||||
remote-only = remote-indeed
|
Loading…
x
Reference in New Issue
Block a user