MockSSH icon indicating copy to clipboard operation
MockSSH copied to clipboard

Rename ArgumentValidatingCommand as SSHCommand

Open ncouture opened this issue 11 years ago • 1 comments

All commands can and should be validating arguments. Commands requiring no argument should be considered "validly typed" if their arguments are None.

With this in mind and as ArgumentValidatingCommand is a subclass of SSHCommand and should be able to provide all of its superclass' functionality, it would simplify MockSSH from a usage perspective to consolidate these classes functionalities under the same one.

With this fix:

  1. ArgumentValidatingCommand is renamed to SSHCommand
  2. SSHCommand is renamed to _SSHCommand
  3. ArgumentValidatingCommand is removed from all
  4. Examples (examples/mock_cisco.py and examples/mock_F5.py) are updated to reflect this change
  5. The hy DSL is updated to reflect this change

ncouture avatar Jul 05 '14 00:07 ncouture

The ArgumentValidatingCommand does not support unknown positional arguments, this is a problem in this use case (see examples/mock_cisco.py):

username john password jd03

In order to replace SSHCommand with ArgumentValidatingCommand we would need to provide that functionality.

Here is an example of what it should support:

command_username = MockSSH.SSHCommand('username', 
                                     [username_command_success], 
                                     [username_command_failure], 
                                     *["<username>", "password", "<password>"])

Where "" and "" are substitutes for anything; wildcards.

ncouture avatar Jul 05 '14 02:07 ncouture