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

fix authorize-account integration tests when testing against non-prod… #269

Merged
merged 1 commit into from
Mar 30, 2024
Merged
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
16 changes: 15 additions & 1 deletion test/integration/test_b2_command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
from b2._internal._cli.const import (
B2_APPLICATION_KEY_ENV_VAR,
B2_APPLICATION_KEY_ID_ENV_VAR,
B2_ENVIRONMENT_ENV_VAR,
)
from b2._internal.console_tool import current_time_millis

Expand All @@ -65,6 +66,7 @@

def test_authorize_account_via_params_saving_credentials(
b2_tool,
realm,
application_key,
application_key_id,
account_info_file,
Expand All @@ -79,7 +81,9 @@ def test_authorize_account_via_params_saving_credentials(
assert B2_APPLICATION_KEY_ID_ENV_VAR not in os.environ
assert B2_APPLICATION_KEY_ENV_VAR not in os.environ

b2_tool.should_succeed(['authorize-account', application_key_id, application_key])
b2_tool.should_succeed(
['authorize-account', '--environment', realm, application_key_id, application_key]
)

assert account_info_file.exists()
account_info = SqliteAccountInfo()
Expand All @@ -89,6 +93,7 @@ def test_authorize_account_via_params_saving_credentials(

def test_authorize_account_via_env_vars_saving_credentials(
b2_tool,
realm,
application_key,
application_key_id,
account_info_file,
Expand All @@ -106,6 +111,7 @@ def test_authorize_account_via_env_vars_saving_credentials(
b2_tool.should_succeed(
['authorize-account'],
additional_env={
B2_ENVIRONMENT_ENV_VAR: realm,
B2_APPLICATION_KEY_ID_ENV_VAR: application_key_id,
B2_APPLICATION_KEY_ENV_VAR: application_key,
}
Expand All @@ -119,6 +125,7 @@ def test_authorize_account_via_env_vars_saving_credentials(

def test_clear_account_with_env_vars(
b2_tool,
realm,
application_key,
application_key_id,
account_info_file,
Expand All @@ -136,6 +143,7 @@ def test_clear_account_with_env_vars(
b2_tool.should_succeed(
['clear-account'],
additional_env={
B2_ENVIRONMENT_ENV_VAR: realm,
B2_APPLICATION_KEY_ID_ENV_VAR: application_key_id,
B2_APPLICATION_KEY_ENV_VAR: application_key,
}
Expand All @@ -152,6 +160,7 @@ def test_clear_account_with_env_vars(
@pytest.mark.apiver(to_ver=3)
def test_command_with_env_vars_saving_credentials(
b2_tool,
realm,
application_key,
application_key_id,
account_info_file,
Expand All @@ -171,6 +180,7 @@ def test_command_with_env_vars_saving_credentials(
b2_tool.should_succeed(
['ls', '--long', *b2_uri_args(bucket_name)],
additional_env={
B2_ENVIRONMENT_ENV_VAR: realm,
B2_APPLICATION_KEY_ID_ENV_VAR: application_key_id,
B2_APPLICATION_KEY_ENV_VAR: application_key,
}
Expand All @@ -185,6 +195,7 @@ def test_command_with_env_vars_saving_credentials(
@pytest.mark.apiver(from_ver=4)
def test_command_with_env_vars_not_saving_credentials(
b2_tool,
realm,
application_key,
application_key_id,
account_info_file,
Expand All @@ -204,6 +215,7 @@ def test_command_with_env_vars_not_saving_credentials(
b2_tool.should_succeed(
['ls', '--long', *b2_uri_args(bucket_name)],
additional_env={
B2_ENVIRONMENT_ENV_VAR: realm,
B2_APPLICATION_KEY_ID_ENV_VAR: application_key_id,
B2_APPLICATION_KEY_ENV_VAR: application_key,
}
Expand All @@ -220,6 +232,7 @@ def test_command_with_env_vars_not_saving_credentials(
@pytest.mark.apiver(from_ver=4)
def test_command_with_env_vars_reusing_existing_account_info(
b2_tool,
realm,
application_key,
application_key_id,
account_info_file,
Expand All @@ -246,6 +259,7 @@ def test_command_with_env_vars_reusing_existing_account_info(
b2_tool.should_succeed(
['ls', '--long', *b2_uri_args(bucket_name)],
additional_env={
B2_ENVIRONMENT_ENV_VAR: realm,
B2_APPLICATION_KEY_ID_ENV_VAR: application_key_id,
B2_APPLICATION_KEY_ENV_VAR: application_key,
}
Expand Down
Loading