def tes_debug(self): global_variables = GlobalVariables(self.properties) self.assertTrue(global_variables.debug) global_variables = GlobalVariables(self.properties3) self.assertFalse(global_variables.debug) global_variables = GlobalVariables(self.properties7) self.assertIsNone(global_variables.debug)
def test_sudo(self): global_variables = GlobalVariables(self.properties) self.assertTrue(global_variables.sudo) global_variables = GlobalVariables(self.properties2) self.assertFalse(global_variables.sudo) global_variables = GlobalVariables(self.properties8) self.assertIsNone(global_variables.sudo)
def setUp(self): self.properties = OrderedDict([('name', 'apache2'), ('action', 'install'), ('after_tasks', 'dummy')]) self.properties_with_sudo_true = OrderedDict([('name', 'apache2'), ('action', 'install'), ('sudo', True)]) self.properties_with_sudo_false = OrderedDict([('name', 'apache2'), ('action', 'install'), ('sudo', False)]) self.global_variables_sudo_true = GlobalVariables( OrderedDict([('sudo', True), ('debug', True)])) self.global_variables_sudo_false = GlobalVariables( OrderedDict([('sudo', False), ('debug', False)]))
def test_name(self): properties = OrderedDict([('name', '{$doc_root}'), ('action', 'create')]) global_variables = GlobalVariables( OrderedDict([('doc_root', '/var/www/html')])) directory_resource = DirectoryResource(properties, global_variables) self.assertEquals('/var/www/html', directory_resource.name)
def test_name(self): properties = OrderedDict([('name', '{$doc_root}/index.php'), ('action', 'create')]) global_variables = GlobalVariables( OrderedDict([('doc_root', '/var/www/html')])) file_resource = FileResource(properties, global_variables) self.assertEquals('/var/www/html/index.php', file_resource.name) properties = OrderedDict([('name', '/home/ubuntu/index.php'), ('action', 'create')]) file_resource = FileResource(properties) self.assertEquals('/home/ubuntu/index.php', file_resource.name)
def test_doc_root(self): global_variables = GlobalVariables(self.properties) self.assertEquals('/var/www/html', global_variables.doc_root) global_variables = GlobalVariables(self.properties3) self.assertIsNone(global_variables.doc_root)
def test_is_sudo_enabled(self): global_variables = GlobalVariables(self.properties) self.assertTrue(global_variables.is_sudo_enabled()) global_variables = GlobalVariables(self.properties2) self.assertFalse(global_variables.is_sudo_enabled()) global_variables = GlobalVariables(self.properties7) self.assertTrue(global_variables.is_sudo_enabled()) global_variables = GlobalVariables(self.properties8) self.assertFalse(global_variables.is_sudo_enabled())
def test_is_debug_mode(self): global_variables = GlobalVariables(self.properties) self.assertTrue(global_variables.is_debug_mode()) global_variables = GlobalVariables(self.properties2) self.assertTrue(global_variables.is_debug_mode()) global_variables = GlobalVariables(self.properties3) self.assertFalse(global_variables.is_debug_mode()) global_variables = GlobalVariables(self.properties7) self.assertFalse(global_variables.is_debug_mode())