11 from straw
.Config
import Config
15 self
.mockPersistence
= Mock( {
19 self
.config
= Config(self
.mockPersistence
)
23 self
.mockPersistence
= None
26 os
.environ
['http_proxy'] = 'http://localhost:3128'
27 self
.config
.initialize_proxy()
28 assert isinstance(self
.config
.proxy
, Config
.EnvironmentProxyConfig
)
29 del os
.environ
['http_proxy']
30 self
.config
.initialize_proxy()
31 assert isinstance(self
.config
.proxy
, Config
.GconfProxyConfig
)
33 def testPollFrequency(self
):
34 def _cb(x
): assert x
is self
.config
36 self
.config
.connect('refresh-changed', _cb
)
37 self
.config
.poll_frequency
= f
38 self
.mockPersistence
.expectParams(Config
.OPTION_POLL_FREQUENCY
, f
)
39 assert self
.config
.poll_frequency
== f
41 def testLastPoll(self
):
43 self
.config
.last_poll
= last_poll
44 self
.mockPersistence
.expectParams(Config
.OPTION_LAST_POLL
, last_poll
)
45 assert self
.config
.last_poll
== last_poll
47 def testItemsStored(self
):
48 def _cb(x
): assert x
is self
.config
50 self
.config
.connect('items-stored-changed', _cb
)
51 self
.config
.number_of_items_stored
= stored
52 assert self
.config
.number_of_items_stored
== stored
54 def testItemOrder(self
):
55 def _cb(x
): assert x
is self
.config
57 self
.config
.connect('item-order-changed', _cb
)
58 self
.config
.item_order
= order
59 assert self
.config
.item_order
== order
61 def testOffline(self
):
62 def _cb(x
): assert x
is self
.config
64 self
.config
.connect('offline-mode-changed', _cb
)
65 self
.config
.offline
= offline
66 assert self
.config
.offline
== offline
68 # feel free to add more tests here ...