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

Tests astartectl pairing agent commands for registration and unregistration #22

Merged
merged 2 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"]
Loading