コード例 #1
0
    def test_none_variable_without_name(self):
        variable = None
        with self.assertRaises(errors.AnsibleFilterError) as ctx:
            defined(variable)

        self.assertEqual(str(ctx.exception), "Variable not defined")
コード例 #2
0
 def test_zero_variable_with_name(self):
     variable = 0
     output = defined(variable, 'var')
     self.assertEqual(output, variable)
コード例 #3
0
 def test_defined_variable_with_name(self):
     variable = 'Hello'
     output = defined(variable, 'var')
     self.assertEqual(output, variable)
コード例 #4
0
    def test_empty_variable_with_name(self):
        variable = ''
        with self.assertRaises(errors.AnsibleFilterError) as ctx:
            defined(variable, 'var')

        self.assertEqual(str(ctx.exception), "Variable not defined: var")
コード例 #5
0
 def test_false_variable_with_name(self):
     variable = False
     output = defined(variable, 'var')
     self.assertEqual(output, variable)
コード例 #6
0
 def test_defined_variable_with_name(self):
     variable = 'Hello'
     output = defined(variable, 'var')
     self.assertEqual(output, variable)
コード例 #7
0
    def test_none_variable_without_name(self):
        variable = None
        with self.assertRaises(errors.AnsibleFilterError) as ctx:
            defined(variable)

        self.assertEqual(str(ctx.exception), "Variable not defined")
コード例 #8
0
 def test_zero_variable_with_name(self):
     variable = 0
     output = defined(variable, 'var')
     self.assertEqual(output, variable)
コード例 #9
0
 def test_false_variable_with_name(self):
     variable = False
     output = defined(variable, 'var')
     self.assertEqual(output, variable)
コード例 #10
0
    def test_empty_variable_with_name(self):
        variable= ''
        with self.assertRaises(errors.AnsibleFilterError) as ctx:
            defined(variable, 'var')

        self.assertEqual(str(ctx.exception), "Variable not defined: var")