Skip to content

Commit

Permalink
Merge pull request #22 from Jusuf95/astartectl_pairing_agent
Browse files Browse the repository at this point in the history
Tests astartectl pairing agent commands for registration and unregistration
  • Loading branch information
Annopaolo authored Nov 22, 2024
2 parents dff03f3 + 4f69d60 commit 0b458dd
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 1 deletion.
1 change: 1 addition & 0 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
pytest -v ./tests/utils
pytest -v ./tests/app_engine
pytest -v ./tests/realm_management
pytest -v ./tests/pairing_agent
52 changes: 52 additions & 0 deletions tests/pairing_agent/test_pairing_agent.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# SPDX-FileCopyrightText: 2024 SECO Mind Srl
#
# SPDX-License-Identifier: Apache-2.0


import subprocess


def test_pairing_agent_register(astarte_env_vars):
astarte_url = astarte_env_vars["astarte_url"]
realm = astarte_env_vars["realm"]
jwt = astarte_env_vars["jwt"]
device_test_2 = astarte_env_vars["device_test_2"]

arg_list = [
"astartectl",
"pairing",
"agent",
"register",
device_test_2,
"-t",
jwt,
"-u",
astarte_url,
"-r",
realm,
]
sample_data_result = subprocess.run(arg_list, capture_output=True, text=True)
assert "successfully registered" in sample_data_result.stdout


def test_pairing_agent_unregister(astarte_env_vars):
astarte_url = astarte_env_vars["astarte_url"]
realm = astarte_env_vars["realm"]
jwt = astarte_env_vars["jwt"]
device_test_2 = astarte_env_vars["device_test_2"]

arg_list = [
"astartectl",
"pairing",
"agent",
"unregister",
device_test_2,
"-t",
jwt,
"-u",
astarte_url,
"-r",
realm,
]
sample_data_result = subprocess.run(arg_list, capture_output=True, text=True, input="y\n")
assert "ok" in sample_data_result.stdout
2 changes: 1 addition & 1 deletion tests/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ profile = "black"
line-length = 88

[tool.setuptools]
packages = ["app_engine", "realm_management", "utils"]
packages = ["app_engine", "realm_management", "utils", "pairing_agent"]

0 comments on commit 0b458dd

Please sign in to comment.