Esempio n. 1
0
 def test_constructor_starred_params(self):
     dt = {
         'name': 'foo',
     }
     ctx = ExecContext(**dt)
     self.assertIsNotNone(ctx.name)
     self.assertEqual(ctx.name, 'foo')
Esempio n. 2
0
 def test_constructor_from_dict(self):
     dt = {
         'name': 'foo',
     }
     ctx = ExecContext(dt)
     self.assertIsNotNone(ctx.name)
     self.assertEqual(ctx.name, 'foo')
Esempio n. 3
0
 def test_2(self):
     config = PluginConfig('pyetl', 'pcaudit', ConfigTextLoader)
     ctx = ExecContext.from_dict(config.load(self.full_data))
     result = ctx["opsi"]
     expected = {
         'username': '******',
         'password': '******'
     }
     self.assertDictEqual(expected, result)
Esempio n. 4
0
 def test_1(self):
     config = PluginConfig('pyetl', 'pcaudit', ConfigTextLoader)
     ctx = ExecContext.from_dict(config.load(self.full_data))
     result = ctx["itop"]
     expected = {
         'username': '******',
         'password': '******',
         'url': 'https://itsm-dev.escolan.recia.fr',
         'version': '1.3',
     }
     self.assertDictEqual(expected, result)
Esempio n. 5
0
 def setUp(self) -> None:
     self.ctx = ExecContext()
     self.ctx['level1'] = {'level2': {'value': 42}}
Esempio n. 6
0
 def test_6(self):
     config = PluginConfig('pyetl', 'pcaudit', ConfigPackageLoader)
     config = config.load(package_name='tests.fixtures')
     ctx = ExecContext.from_dict(config)
     result = ctx.itop.version
     self.assertEqual('1.3', result)
Esempio n. 7
0
    def test_5(self):
        config = PluginConfig('pyetl', 'pcaudit', ConfigTextLoader)

        ctx = ExecContext.from_dict(config.load(self.full_data))
        result = ctx.itop.version
        self.assertEqual('1.3', result)
Esempio n. 8
0
 def test_4(self):
     config = PluginConfig('pyetl', 'pcaudit', ConfigTextLoader)
     ctx = ExecContext.from_dict(config.load(self.full_data))
     with self.assertRaises(TypeError):
         _ = ctx["opsi.username.wrong"]
Esempio n. 9
0
 def test_3(self):
     config = PluginConfig('pyetl', 'pcaudit', ConfigTextLoader)
     ctx = ExecContext.from_dict(config.load(self.full_data))
     with self.assertRaises(KeyError):
         _ = ctx["unknown"]
Esempio n. 10
0
 def test_method_has_property(self):
     ctx = ExecContext()
     self.assertTrue(hasattr(ctx, 'has_property'))
     self.assertFalse(ctx.has_property('spam'))