def test_on_scaleway_cmdline(self, m_read_dmi_data, m_file_exists, m_get_cmdline): """ "scaleway" in /proc/cmdline. """ self.install_mocks(fake_dmi=(m_read_dmi_data, False), fake_file_exists=(m_file_exists, False), fake_cmdline=(m_get_cmdline, True)) self.assertTrue(DataSourceScaleway.on_scaleway())
def test_on_scaleway_var_run_scaleway(self, m_read_dmi_data, m_file_exists, m_get_cmdline): """ /var/run/scaleway exists. """ self.install_mocks(fake_dmi=(m_read_dmi_data, False), fake_file_exists=(m_file_exists, True), fake_cmdline=(m_get_cmdline, False)) self.assertTrue(DataSourceScaleway.on_scaleway())
def test_on_scaleway_dmi(self, m_read_dmi_data, m_file_exists, m_get_cmdline): """ dmidecode returns "Scaleway". """ # dmidecode returns "Scaleway" self.install_mocks(fake_dmi=(m_read_dmi_data, True), fake_file_exists=(m_file_exists, False), fake_cmdline=(m_get_cmdline, False)) self.assertTrue(DataSourceScaleway.on_scaleway())
def test_on_scaleway_cmdline(self, m_read_dmi_data, m_file_exists, m_get_cmdline): """ "scaleway" in /proc/cmdline. """ self.install_mocks( fake_dmi=(m_read_dmi_data, False), fake_file_exists=(m_file_exists, False), fake_cmdline=(m_get_cmdline, True) ) self.assertTrue(DataSourceScaleway.on_scaleway())
def test_on_scaleway_var_run_scaleway(self, m_read_dmi_data, m_file_exists, m_get_cmdline): """ /var/run/scaleway exists. """ self.install_mocks( fake_dmi=(m_read_dmi_data, False), fake_file_exists=(m_file_exists, True), fake_cmdline=(m_get_cmdline, False) ) self.assertTrue(DataSourceScaleway.on_scaleway())
def test_not_on_scaleway(self, m_read_dmi_data, m_file_exists, m_get_cmdline): self.install_mocks(fake_dmi=(m_read_dmi_data, False), fake_file_exists=(m_file_exists, False), fake_cmdline=(m_get_cmdline, False)) self.assertFalse(DataSourceScaleway.on_scaleway()) # When not on Scaleway, get_data() returns False. datasource = DataSourceScaleway.DataSourceScaleway( settings.CFG_BUILTIN, None, helpers.Paths({'run_dir': self.tmp})) self.assertFalse(datasource.get_data())
def test_on_scaleway_dmi(self, m_read_dmi_data, m_file_exists, m_get_cmdline): """ dmidecode returns "Scaleway". """ # dmidecode returns "Scaleway" self.install_mocks( fake_dmi=(m_read_dmi_data, True), fake_file_exists=(m_file_exists, False), fake_cmdline=(m_get_cmdline, False) ) self.assertTrue(DataSourceScaleway.on_scaleway())
def test_not_on_scaleway(self, m_read_dmi_data, m_file_exists, m_get_cmdline): self.install_mocks( fake_dmi=(m_read_dmi_data, False), fake_file_exists=(m_file_exists, False), fake_cmdline=(m_get_cmdline, False) ) self.assertFalse(DataSourceScaleway.on_scaleway()) # When not on Scaleway, get_data() returns False. datasource = DataSourceScaleway.DataSourceScaleway( settings.CFG_BUILTIN, None, helpers.Paths({'run_dir': self.tmp}) ) self.assertFalse(datasource.get_data())