def test_constructor_starred_params(self): dt = { 'name': 'foo', } ctx = ExecContext(**dt) self.assertIsNotNone(ctx.name) self.assertEqual(ctx.name, 'foo')
def test_constructor_from_dict(self): dt = { 'name': 'foo', } ctx = ExecContext(dt) self.assertIsNotNone(ctx.name) self.assertEqual(ctx.name, 'foo')
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)
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)
def setUp(self) -> None: self.ctx = ExecContext() self.ctx['level1'] = {'level2': {'value': 42}}
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)
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)
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"]
def test_3(self): config = PluginConfig('pyetl', 'pcaudit', ConfigTextLoader) ctx = ExecContext.from_dict(config.load(self.full_data)) with self.assertRaises(KeyError): _ = ctx["unknown"]
def test_method_has_property(self): ctx = ExecContext() self.assertTrue(hasattr(ctx, 'has_property')) self.assertFalse(ctx.has_property('spam'))