From 37e50fecc34adf2103540ec3f4cf65767d7e3848 Mon Sep 17 00:00:00 2001 From: Kamil Cukrowski Date: Mon, 2 Sep 2024 23:20:44 +0200 Subject: [PATCH] tests: fix listattributes tests --- tests/integration/test_constrainteval.py | 6 ------ tests/integration/test_listattributes.py | 13 +++++++++++++ 2 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 tests/integration/test_listattributes.py diff --git a/tests/integration/test_constrainteval.py b/tests/integration/test_constrainteval.py index 6afea70..3e6e98d 100644 --- a/tests/integration/test_constrainteval.py +++ b/tests/integration/test_constrainteval.py @@ -26,9 +26,3 @@ def test_constrainteval_3(): ) assert pp.stdout is not None assert pp.stdout == "" - - -def test_constrainteval_prefix(): - pp = run_nomadt("constrainteval --json --prefix attr.", stdout=subprocess.PIPE) - assert pp.stdout - assert len(json.loads(pp.stdout)) >= 10, f"{pp}" diff --git a/tests/integration/test_listattributes.py b/tests/integration/test_listattributes.py new file mode 100644 index 0000000..24359b0 --- /dev/null +++ b/tests/integration/test_listattributes.py @@ -0,0 +1,13 @@ +import json +import subprocess + +from tests.testlib import run_nomadt + + +def test_listattributes_1(): + pp = run_nomadt("listattributes --json", stdout=subprocess.PIPE) + assert pp.stdout + name = json.loads(pp.stdout)[0]["node.unique.name"] + pp = run_nomadt(f"listattributes --json {name}", stdout=subprocess.PIPE) + assert pp.stdout + assert json.loads(pp.stdout)[0]["node.unique.name"] == name