Skip to content

Commit

Permalink
fix authorize-account integration tests when testing against non-prod…
Browse files Browse the repository at this point in the history
…uction realm
  • Loading branch information
mjurbanski-reef committed Mar 29, 2024
1 parent 0f81ed3 commit fcc4afc
Showing 1 changed file with 15 additions and 1 deletion.
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

0 comments on commit fcc4afc

Please sign in to comment.