Skip to main content

python unit test for network automation code

Project description

Simple package to run unit test for network automation python3 code.

Explanation by examples:

INPUT can be either a file or a return str() or list() Usually is the output of a show command

input = open('../fixtures/ssh_input', 'r')

HAVE is the return of you code run on top of INPUT

have = open('../fixtures/have', 'r')

WANT must be a file where you have your expected output

want = open('../fixtures/want', 'r')

Create an instance of NaTest

my_test = NaTest()

print the input. Ideally the input is saved in a variable and use to run your code (instead of run real ssh commands)

print(my_test.read(input))

print diff between what we HAVE and what we WANT

print(my_test.result(want, have))

Result (compared WANT against HAVE after running code using INPUT):

['+ This is an extra line\n']
['- This is a missing line\n']

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

natest-0.8-py2-none-any.whl (2.4 kB view details)

Uploaded Python 2

File details

Details for the file natest-0.8-py2-none-any.whl.

File metadata

  • Download URL: natest-0.8-py2-none-any.whl
  • Upload date:
  • Size: 2.4 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.0

File hashes

Hashes for natest-0.8-py2-none-any.whl
Algorithm Hash digest
SHA256 efbee775c7230c66ed6a76ddb44c7c16ce62abfff9040b28f76a72a6639a6d05
MD5 225dacec64c16aa04370335fad634b13
BLAKE2b-256 fc3ac5874cb67e1a86f83db0b46000e3f2fc233c727b261c18b1517d70aa2e33

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page