Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow file-less test execution when using jsnapy as a library #308

Open
Mierdin opened this issue Mar 14, 2018 · 2 comments
Open

Allow file-less test execution when using jsnapy as a library #308

Mierdin opened this issue Mar 14, 2018 · 2 comments

Comments

@Mierdin
Copy link

Mierdin commented Mar 14, 2018

From what I can tell after an admittedly brief look, it seems that only config data can be passed into the jsnapy Python API.

Would be nice to also be able to pass in test data as a dictionary, so I don't have to create any files at all when interacting at the Python level only

@sidhujasminder
Copy link
Contributor

@Mierdin You mean like we pass the config data as follows, we should also do the same for testfiles?

config_data = """
hosts:
  - device: 1.1.1.1
    username : demo 
    passwd: demo123
tests:
  - test_is_equal.yml
"""

Somewhat like:

test_is_equal="""
test_interfaces_terse:
  - command: show interfaces terse lo*  
  - iterate:
      id: ./name
      xpath: //physical-interface
      tests:
        - is-equal: admin-status, up
          info: "Test Succeeded !! admin-status of interface <{{post['name']}}> is equal to <{{post['admin-status']}}> with oper-status <{{ pre['oper-status'] }}>"
          err: "Test Failed !! admin-status of interface <{{ post['name'] }}> is not equal to down, it is <{{post['admin-status']}}> with oper-status <{{pre['oper-status']}}>"
"""

@Mierdin
Copy link
Author

Mierdin commented Mar 14, 2018

In general yes - though I would highly recommend these parameters are accepted as dictionaries, not strings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants