Skip to content

Commit

Permalink
Add tests for native apteryx namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
carlgsmith committed Aug 3, 2023
1 parent 05a71cc commit 6ce3a4c
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
('/t2:test/settings/priority', '2'),
# Non-default namespace augmented path
('/t2:test/settings/speed', '2'),
# Apteryx namespace
('/test3/state/age', '99'),
]


Expand Down
24 changes: 24 additions & 0 deletions tests/test_get.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ def test_restconf_get_single_node_ns_default():
assert response.json() == json.loads('{ "testing:priority": 1 }')


def test_restconf_get_single_node_ns_apteryx():
response = requests.get("{}{}/data/test3/state/age".format(server_uri, docroot), auth=server_auth, headers=get_restconf_headers)
print(json.dumps(response.json(), indent=4, sort_keys=True))
assert response.status_code == 200
assert response.headers["Content-Type"] == "application/yang-data+json"
assert response.json() == json.loads('{ "age": "99" }')


def test_restconf_get_single_node_ns_aug_default():
response = requests.get("{}{}/data/testing:test/settings/volume".format(server_uri, docroot), auth=server_auth, headers=get_restconf_headers)
print(json.dumps(response.json(), indent=4, sort_keys=True))
Expand Down Expand Up @@ -209,6 +217,22 @@ def test_restconf_get_trunk_other_namespace():
""")


def test_restconf_get_trunk_ns_apteryx():
response = requests.get("{}{}/data/test3".format(server_uri, docroot), auth=server_auth, headers=get_restconf_headers)
print(json.dumps(response.json(), indent=4, sort_keys=True))
assert response.status_code == 200
assert response.headers["Content-Type"] == "application/yang-data+json"
assert response.json() == json.loads("""
{
"test3": {
"state": {
"age": "99"
}
}
}
""")


def test_restconf_get_list_trunk():
response = requests.get("{}{}/data/testing:test/animals".format(server_uri, docroot), auth=server_auth, headers=get_restconf_headers)
print(json.dumps(response.json(), indent=4, sort_keys=True))
Expand Down
10 changes: 10 additions & 0 deletions tests/test_yang_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ def test_restconf_yang_library_tree():
"namespace": "http://test.com/ns/yang/testing-2",
"revision": "2023-02-01"
},
{
"name": "testing-3",
"namespace": "http://test.com/ns/yang/testing-3",
"revision": "2023-03-01"
},
{
"name": "testing2-augmented",
"namespace": "http://test.com/ns/yang/testing2-augmented",
Expand Down Expand Up @@ -143,6 +148,11 @@ def test_restconf_yang_library_data():
"namespace": "http://test.com/ns/yang/testing-2",
"revision": "2023-02-01"
},
{
"name": "testing-3",
"namespace": "http://test.com/ns/yang/testing-3",
"revision": "2023-03-01"
},
{
"name": "testing2-augmented",
"namespace": "http://test.com/ns/yang/testing2-augmented",
Expand Down

0 comments on commit 6ce3a4c

Please sign in to comment.