netdev icon indicating copy to clipboard operation
netdev copied to clipboard

Create mock tests

Open selfuryon opened this issue 7 years ago • 3 comments

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

selfuryon avatar Feb 02 '19 18:02 selfuryon

Need to think about how to do it. Just create a file which class will be read line-by-line? Or something else.

selfuryon avatar Feb 02 '19 18:02 selfuryon

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() and send_config_set() for getting the right file
  • maybe need to mock read_until_pattern()

selfuryon avatar Feb 02 '19 21:02 selfuryon

The main goal is to replace self._stdin and self._stdout. I need to create a similar interface like SSHClientSession

selfuryon avatar Feb 03 '19 18:02 selfuryon