def test_write_config_sets_all_members_except_device(self): mock_configparser = Mock() self.config.write_config(mock_configparser) for member in self.config.members(): if (member != '_device' and member not in self.config._private_settings): mock_configparser.set.assert_any_call( self.section, member, getattr(self.config, member)) device_call = call.set(self.section, '_device', ANY) assert device_call not in mock_configparser.mock_calls for private_setting in self.config._private_settings: device_call = call.set(self.section, private_setting, ANY) assert device_call not in mock_configparser.mock_calls
def test_gauge(self): """Tests setting a gauge with ``R.gauge``. Verifies that the gauge slug is added to the set of gauge slugs and that the value gets set.""" self.r.gauge('test-gauge', 9000) self.redis.assert_has_calls([ call.sadd(self.r._gauge_slugs_key, 'test-gauge'), call.set('g:test-gauge', 9000), ])
def test_start(self): """ Does it clear the event then start the timer? """ self.timer.start() # first call - create the event and set # second call - clear the call so users will block # third call - start the timer calls = [call.set(), call.clear(), call.start()] self.assertEqual(calls, self.timer.event.mock_calls + self.timer.timer.mock_calls) return
def test_stop(self): self.subject.stop_event = Mock() self.subject.stop() self.assert_(self.subject.stop_event.mock_calls == [call.set()])