diff -r 8ad6c097bc5b -r b381eaa774ab tests/offer.py --- a/tests/offer.py Thu Feb 23 16:59:49 2012 +0100 +++ b/tests/offer.py Sat Feb 25 16:12:07 2012 +0100 @@ -4,7 +4,7 @@ import io from iro.model import offer -from iro.config import config +from iro.config import configParser from iro.offer import Offer, providers as OfferProviders, Provider from iro.model.schema import User, Offer as DBOffer, Userright from iro.controller.pool import dbPool @@ -18,8 +18,8 @@ dbPool.start(reactor) def tearDown(self): - for s in config.sections(): - config.remove_section(s) + for s in configParser.sections(): + configParser.remove_section(s) dbPool.pool.stop() offer.offers.clear() @@ -34,7 +34,7 @@ def testReloadList(self): '''test if loadOffers will be fired by reloading Config''' - self.assertTrue(offer.loadOffers in config.reloadList) + self.assertTrue(offer.loadOffers in configParser.reloadList) @inlineCallbacks def testExtendProviderUnknown(self): @@ -72,7 +72,7 @@ o=DBOffer(name="oh", provider="bla", route="a", typ="sms") u.rights.append(Userright(o)) - offer.providers={"bla":Provider("bla", [], {"sms":["a","b","c"]})} + offer.providers={"bla":Provider("bla", {"sms":["a","b","c"]})} for l in [['bla'],['oh'],['oh','bla'],['bla','oh']]: ret = yield offer.extendProvider(u, "sms", l) @@ -89,7 +89,7 @@ o=DBOffer(name="a", provider="bla", route="b", typ="sms") u.rights.append(Userright(o)) - offer.providers={"bla":Provider("bla", [], {"sms":["a","b","c"]})} + offer.providers={"bla":Provider("bla", {"sms":["a","b","c"]})} ret = yield offer.extendProvider(u, "sms", ["bla"]) self.assertEqual(ret, ["oh","a"]) @@ -104,9 +104,8 @@ def testLoadOffers(self): class TestProvider(Provider): - def __init__(self,name,config): - Provider.__init__(self,name,config,{"sms":["a",]}) - self.loadConfig() + def __init__(self,name): + Provider.__init__(self,name,{"sms":["a",]}) with self.session() as session: session.add(DBOffer(name="oh", provider="p", route="a", typ="sms")) @@ -114,7 +113,7 @@ sample_config = """[p] typ = test """ - config.readfp(io.BytesIO(sample_config)) + configParser.readfp(io.BytesIO(sample_config)) OfferProviders["test"]=TestProvider yield offer.loadOffers() self.assertEqual(offer.offers.keys(),["oh"]) @@ -130,7 +129,7 @@ sample_config = """[p] typ = unknown """ - config.readfp(io.BytesIO(sample_config)) + configParser.readfp(io.BytesIO(sample_config)) d = offer.loadOffers() self.assertFailure(d, NoProvider) return d