netdev
netdev copied to clipboard
Create mock tests
Need to create mock tests for fast developing otherwise I need to test all classes after each significant commit to base classes. It's too hard and I can't use it in CI/CD
Need to think about how to do it. Just create a file which class will be read line-by-line? Or something else.
I want to read a particular file when running a particular command, so I'll have files like these:
-
show_run.txt -
show_ver - etc
So when the code needs to run show run command it should read show_run.txt file.
Some thoughts:
- mock
establish_connection()for reading only text files without real ssh connections - mock
send_command()andsend_config_set()for getting the right file - maybe need to mock
read_until_pattern()
The main goal is to replace self._stdin and self._stdout. I need to create a similar interface like SSHClientSession