From 916f384b7b9031193801a9a83ec7bab08c3231f1 Mon Sep 17 00:00:00 2001 From: Pedro de Oliveira Guedes Date: Fri, 14 Jan 2022 10:27:34 -0300 Subject: [PATCH] Tests for environment variables getters. --- api/replay/features/replay.feature | 6 ++++++ api/replay/features/steps/steps.py | 16 ++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/api/replay/features/replay.feature b/api/replay/features/replay.feature index e69de29..05511a0 100644 --- a/api/replay/features/replay.feature +++ b/api/replay/features/replay.feature @@ -0,0 +1,6 @@ +Feature: The environment variables getters + + Scenario: Testing every environment variable getter + Given the Replay client + When each one of the getters is called + Then all of the returns must be either of the type string or the type None \ No newline at end of file diff --git a/api/replay/features/steps/steps.py b/api/replay/features/steps/steps.py index e69de29..71746a1 100644 --- a/api/replay/features/steps/steps.py +++ b/api/replay/features/steps/steps.py @@ -0,0 +1,16 @@ +from behave import * +from cli import Replay + +# ============================= ENVIRONMENT VARIABLES GETTERS ============================= +@given(u'the Replay client') +def step_impl (context): + context.client = Replay () + +@when(u'each one of the getters is called') +def step_impl(context): + context.returns = {context.client.replay_env_queue_id(): "context.client.replay_env_queue_id()", context.client.replay_env_alias(): "context.client.replay_env_alias()", context.client.replay_env_feature_dir(): "context.client.replay_env_feature_dir()", context.client.replay_env_root(): "context.client.replay_env_root()", context.client.replay_env_addr(): "context.client.replay_env_addr()", context.client.replay_env_home_dir(): "context.client.replay_env_home_dir()", context.client.replay_env_repo(): "context.client.replay_env_repo()", context.client.replay_env_ver(): "context.client.replay_env_ver()", context.client.replay_env_repo_dir(): "context.client.replay_env_repo_dir()", context.client.replay_env_data_dir(): "context.client.replay_env_data_dir()", context.client.replay_env_instance_alias(): "context.client.replay_env_instance_alias()", context.client.replay_env_api_key(): "context.client.replay_env_api_key()"} + +@then(u'all of the returns must be either of the type string or the type None') +def step_impl(context): + for ret in context.returns.keys(): + assert ( type(ret) == type(None) or type(ret) == type("") ), f'Something went wrong with the {context.returns[ret]} variable getter.'