def test_no_client_table(self, pluginCronTab_mock): conf = XmlConfigParser() conf.setXml(r"""<configuration plugin="status"> <settings name="settings"> <set name="interval">60</set> <set name="output_file">~/status.xml</set> </settings> </configuration>""") self.p = StatusPlugin(self.console, conf) self.p.onLoadConfig() self.assertEqual("current_clients", self.p._clientTable)
def test_no_client_table(self, pluginCronTab_mock): conf = CfgConfigParser() conf.loadFromString(dedent(r""" [settings] interval: 60 output_file: ~/status.xml enableDBsvarSaving: no enableDBclientSaving: no """)) self.p = StatusPlugin(self.console, conf) self.p._tables = { 'svars': 'current_svars', 'cvars': 'current_clients' } self.p.onLoadConfig() self.assertEqual("current_clients", self.p._tables['cvars'])
class Test_config(B3TestCase): @patch("b3.cron.PluginCronTab") def test_no_svar_table(self, pluginCronTab_mock): conf = XmlConfigParser() conf.setXml(r"""<configuration plugin="status"> <settings name="settings"> <set name="interval">60</set> <set name="output_file">~/status.xml</set> </settings> </configuration>""") self.p = StatusPlugin(self.console, conf) self.p.onLoadConfig() self.assertEqual("current_svars", self.p._svarTable) @patch("b3.cron.PluginCronTab") def test_svar_table(self, pluginCronTab_mock): conf = XmlConfigParser() conf.setXml(r"""<configuration plugin="status"> <settings name="settings"> <set name="interval">60</set> <set name="output_file">~/status.xml</set> <set name="svar_table">alternate_svar_table</set> </settings> </configuration>""") self.p = StatusPlugin(self.console, conf) self.p.onLoadConfig() self.assertEqual("alternate_svar_table", self.p._svarTable) @patch("b3.cron.PluginCronTab") def test_no_client_table(self, pluginCronTab_mock): conf = XmlConfigParser() conf.setXml(r"""<configuration plugin="status"> <settings name="settings"> <set name="interval">60</set> <set name="output_file">~/status.xml</set> </settings> </configuration>""") self.p = StatusPlugin(self.console, conf) self.p.onLoadConfig() self.assertEqual("current_clients", self.p._clientTable) @patch("b3.cron.PluginCronTab") def test_client_table(self, pluginCronTab_mock): conf = XmlConfigParser() conf.setXml(r"""<configuration plugin="status"> <settings name="settings"> <set name="interval">60</set> <set name="output_file">~/status.xml</set> <set name="client_table">alternate_client_table</set> </settings> </configuration>""") self.p = StatusPlugin(self.console, conf) self.p.onLoadConfig() self.assertEqual("alternate_client_table", self.p._clientTable)
def test_no_client_table(self, pluginCronTab_mock): conf = XmlConfigParser() conf.setXml( r"""<configuration plugin="status"> <settings name="settings"> <set name="interval">60</set> <set name="output_file">~/status.xml</set> </settings> </configuration>""" ) self.p = StatusPlugin(self.console, conf) self.p.onLoadConfig() self.assertEqual("current_clients", self.p._clientTable)
class Test_config(B3TestCase): @patch("b3.cron.PluginCronTab") def test_no_svar_table(self, pluginCronTab_mock): conf = CfgConfigParser() conf.loadFromString(dedent(r""" [settings] interval: 60 output_file: ~/status.xml enableDBsvarSaving: no enableDBclientSaving: no """)) self.p = StatusPlugin(self.console, conf) self.p._tables = { 'svars': 'current_svars', 'cvars': 'current_clients' } self.p.onLoadConfig() self.assertEqual("current_svars", self.p._tables['svars']) @patch("b3.cron.PluginCronTab") def test_svar_table(self, pluginCronTab_mock): conf = CfgConfigParser() conf.loadFromString(dedent(r""" [settings] interval: 60 output_file: ~/status.xml enableDBsvarSaving: yes enableDBclientSaving: no svar_table: alternate_svar_table """)) self.p = StatusPlugin(self.console, conf) self.p._tables = { 'svars': 'current_svars', 'cvars': 'current_clients' } self.p.onLoadConfig() self.assertEqual("alternate_svar_table", self.p._tables['svars']) @patch("b3.cron.PluginCronTab") def test_no_client_table(self, pluginCronTab_mock): conf = CfgConfigParser() conf.loadFromString(dedent(r""" [settings] interval: 60 output_file: ~/status.xml enableDBsvarSaving: no enableDBclientSaving: no """)) self.p = StatusPlugin(self.console, conf) self.p._tables = { 'svars': 'current_svars', 'cvars': 'current_clients' } self.p.onLoadConfig() self.assertEqual("current_clients", self.p._tables['cvars']) @patch("b3.cron.PluginCronTab") def test_client_table(self, pluginCronTab_mock): conf = CfgConfigParser() conf.loadFromString(dedent(r""" [settings] interval: 60 output_file: ~/status.xml enableDBsvarSaving: no enableDBclientSaving: yes client_table: alternate_client_table """)) self.p = StatusPlugin(self.console, conf) self.p._tables = { 'svars': 'current_svars', 'cvars': 'current_clients' } self.p.onLoadConfig() self.assertEqual("alternate_client_table", self.p._tables['cvars'])
class Test_config(B3TestCase): @patch("b3.cron.PluginCronTab") def test_no_svar_table(self, pluginCronTab_mock): conf = XmlConfigParser() conf.setXml( r"""<configuration plugin="status"> <settings name="settings"> <set name="interval">60</set> <set name="output_file">~/status.xml</set> </settings> </configuration>""" ) self.p = StatusPlugin(self.console, conf) self.p.onLoadConfig() self.assertEqual("current_svars", self.p._svarTable) @patch("b3.cron.PluginCronTab") def test_svar_table(self, pluginCronTab_mock): conf = XmlConfigParser() conf.setXml( r"""<configuration plugin="status"> <settings name="settings"> <set name="interval">60</set> <set name="output_file">~/status.xml</set> <set name="svar_table">alternate_svar_table</set> </settings> </configuration>""" ) self.p = StatusPlugin(self.console, conf) self.p.onLoadConfig() self.assertEqual("alternate_svar_table", self.p._svarTable) @patch("b3.cron.PluginCronTab") def test_no_client_table(self, pluginCronTab_mock): conf = XmlConfigParser() conf.setXml( r"""<configuration plugin="status"> <settings name="settings"> <set name="interval">60</set> <set name="output_file">~/status.xml</set> </settings> </configuration>""" ) self.p = StatusPlugin(self.console, conf) self.p.onLoadConfig() self.assertEqual("current_clients", self.p._clientTable) @patch("b3.cron.PluginCronTab") def test_client_table(self, pluginCronTab_mock): conf = XmlConfigParser() conf.setXml( r"""<configuration plugin="status"> <settings name="settings"> <set name="interval">60</set> <set name="output_file">~/status.xml</set> <set name="client_table">alternate_client_table</set> </settings> </configuration>""" ) self.p = StatusPlugin(self.console, conf) self.p.onLoadConfig() self.assertEqual("alternate_client_table", self.p._clientTable)