Add tests for get_config

Add test cases for normal and sanitized versions.
Add support for config mode in mock device.
This commit is contained in:
Marcus Hoff
2020-10-22 14:54:34 +02:00
parent 5ab6f4de21
commit 7107560f84
7 changed files with 505 additions and 0 deletions

View File

@@ -51,7 +51,16 @@ class PatchedVyOSDriver(vyos.VyOSDriver):
class FakeVyOSDevice(BaseTestDouble):
"""VyOS device test double."""
def __init__(self):
self.mode_config = False
def send_command(self, command, **kwargs):
filename = '{}.text'.format(self.sanitize_text(command))
full_path = self.find_file(filename)
return self.read_txt_file(full_path)
def config_mode(self):
self.mode_config = True
def exit_config_mode(self):
self.mode_config = False