コード例 #1
0
    def test_should_properly_get_config(self, logger, requests):
        client = NetconfServerClient('localhost')
        client.logger = logging.getLogger()

        client.get_config()

        requests.get.assert_called_with('http://localhost:8080/netconf/get')
コード例 #2
0
    def test_should_properly_edit_config(self, logger, requests):
        client = NetconfServerClient('localhost')
        client.logger = logging.getLogger()

        client.edit_config('example')

        requests.post.assert_called()
コード例 #3
0
    def test_should_properly_delete_yang_model(self, logger, requests):
        client = NetconfServerClient('localhost')
        client.logger = logging.getLogger()

        client.delete_yang_model('sample_model_name')

        requests.delete.assert_called()
コード例 #4
0
    def test_should_properly_load_yang_model(self, logger, requests):
        client = NetconfServerClient('localhost')
        client.logger = logging.getLogger()

        client.load_yang_model('sample_module_name', 'example', 'example')

        requests.post.assert_called()
コード例 #5
0
    def test_should_raise_exception_when_module_is_absent_and_container_is_present(
            self, logger):
        client = NetconfServerClient('localhost')
        client.logger = logging.getLogger()

        with self.assertRaises(AttributeError) as context:  # pylint: disable=W0612
            client.get_config(container="test")
コード例 #6
0
    def test_should_properly_run_less_like_mode(self, logger, requests):
        client = NetconfServerClient('localhost')
        client.logger = logging.getLogger()

        client.less_like_func(100)

        requests.get.assert_called_with(params={"offset": 100},
                                        url="http://localhost:8080/store/less")
コード例 #7
0
    def test_should_properly_get_config_for_given_module(
            self, logger, requests):
        client = NetconfServerClient('localhost')
        client.logger = logging.getLogger()

        client.get_config("module", "container")

        requests.get.assert_called_with(
            'http://localhost:8080/netconf/get/module/container')