示例#1
0
    def test_configured(self):
        ret = {"changes": {}, "comment": "Loaded.", "name": "test", "result": False}
        load_config = MagicMock(return_value={"comment": "Loaded."})

        with patch("salt.utils.files.fopen"):
            with patch.dict(netyang.__salt__, {"napalm_yang.load_config": load_config}):
                with patch.dict(netyang.__opts__, {"test": False}):
                    self.assertDictEqual(
                        netyang.configured("test", "test", models=("model1",)), ret
                    )

                    assert load_config.called
示例#2
0
    def test_configured(self):
        ret = {
            'changes': {},
            'comment': 'Loaded.',
            'name': 'test',
            'result': False
        }
        load_config = MagicMock(return_value={'comment': 'Loaded.'})

        with patch('salt.utils.files.fopen'):
            with patch.dict(netyang.__salt__,
                            {'napalm_yang.load_config': load_config}):
                with patch.dict(netyang.__opts__, {'test': False}):
                    self.assertDictEqual(
                        netyang.configured('test', 'test',
                                           models=('model1', )), ret)

                    assert load_config.called