Skip to content

Commit

Permalink
fix test error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
pragatimodi committed Dec 20, 2023
1 parent ba9d8f4 commit c67e047
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions firebase_admin/multi_factor_config_mgt.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def validate(self):
# pylint: disable=C0123
if type(self.adjacent_intervals) is not int:
raise ValueError(
'TOTPProviderConfig.adjacent_intervals must be an integer between'
'totp_provider_config.adjacent_intervals must be an integer between'
' 1 and 10 (inclusive).')
if not 1 <= self.adjacent_intervals <= 10:
raise ValueError(
Expand Down Expand Up @@ -209,11 +209,11 @@ def validate(self):
'multi_factor_config.provider_configs must be specified')
if not isinstance(self.provider_configs, list) or not self.provider_configs:
raise ValueError(
'provider_configs must be an array of type ProviderConfigs.')
'provider_configs must be an array of type ProviderConfig.')
for provider_config in self.provider_configs:
if not isinstance(provider_config, ProviderConfig):
raise ValueError(
'provider_configs must be an array of type ProviderConfigs.')
'provider_configs must be an array of type ProviderConfig.')
provider_config.validate()

def build_server_request(self):
Expand Down
12 changes: 6 additions & 6 deletions tests/test_multi_factor_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def test_invalid_provider_configs_type(self, provider_configs):
with pytest.raises(ValueError) as excinfo:
test_config.build_server_request()
assert str(excinfo.value).startswith('provider_configs must be an array of type'
' ProviderConfigs.')
' ProviderConfig.')

@pytest.mark.parametrize('provider_configs',
[[True], [1, 2],
Expand All @@ -55,7 +55,7 @@ def test_invalid_mfa_config_provider_config(self, provider_configs):
with pytest.raises(ValueError) as excinfo:
test_config.build_server_request()
assert str(excinfo.value).startswith('provider_configs must be an array of type'
' ProviderConfigs.')
' ProviderConfig.')


class TestProviderConfig:
Expand All @@ -73,7 +73,7 @@ def test_undefined_provider_config_state(self):
with pytest.raises(ValueError) as excinfo:
test_config.build_server_request()
assert str(excinfo.value).startswith(
'provider_config.state must be defined.')
'ProviderConfig.state must be defined.')

@pytest.mark.parametrize('state',
['', 1, True, False, [], (), {}, "foo", 'ENABLED'])
Expand All @@ -83,7 +83,7 @@ def test_invalid_provider_config_state(self, state):
)
with pytest.raises(ValueError) as excinfo:
test_config.build_server_request()
assert str(excinfo.value).startswith('provider_config.state must be of type'
assert str(excinfo.value).startswith('ProviderConfig.state must be of type'
' ProviderConfig.State.')

@pytest.mark.parametrize('state',
Expand All @@ -93,7 +93,7 @@ def test_undefined_totp_provider_config(self, state):
test_config = multi_factor_config_mgt.ProviderConfig(state=state)
with pytest.raises(ValueError) as excinfo:
test_config.build_server_request()
assert str(excinfo.value).startswith('provider_config.totp_provider_config must be'
assert str(excinfo.value).startswith('ProviderConfig.totp_provider_config must be'
' defined.')

@pytest.mark.parametrize('totp_provider_config',
Expand All @@ -103,7 +103,7 @@ def test_invalid_totp_provider_config_type(self, totp_provider_config):
test_config.totp_provider_config = totp_provider_config
with pytest.raises(ValueError) as excinfo:
test_config.build_server_request()
assert str(excinfo.value).startswith('provider_configs.totp_provider_config must be of type'
assert str(excinfo.value).startswith('ProviderConfig.totp_provider_config must be of type'
' TOTPProviderConfig.')


Expand Down

0 comments on commit c67e047

Please sign in to comment.