Skip to content

Commit

Permalink
Merge pull request #138 from Bastian-Krause/bst/error-message-consist…
Browse files Browse the repository at this point in the history
…ency

config-file/test: make error messages more consistent
  • Loading branch information
Bastian-Krause authored Oct 13, 2022
2 parents 12ace4e + bce998d commit 30d2415
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/config-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,12 +261,12 @@ Config* load_config_file(const gchar *config_file, GError **error)
&config->gateway_token, NULL, NULL);
if (!key_auth_token_exists && !key_gateway_token_exists) {
g_set_error(error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_INVALID_VALUE,
"Neither auth_token nor gateway_token is set in the config.");
"Neither 'auth_token' nor 'gateway_token' set");
return NULL;
}
if (key_auth_token_exists && key_gateway_token_exists) {
g_set_error(error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_INVALID_VALUE,
"Both auth_token and gateway_token are set in the config.");
"Both 'auth_token' and 'gateway_token' set");
return NULL;
}

Expand Down Expand Up @@ -314,7 +314,7 @@ Config* load_config_file(const gchar *config_file, GError **error)
config->timeout < config->connect_timeout) {
g_set_error(error,
G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_INVALID_VALUE,
"timeout (%d) must be greater than connect_timeout (%d)",
"'timeout' (%d) must be greater than 'connect_timeout' (%d)",
config->timeout, config->connect_timeout);
return NULL;
}
Expand Down
4 changes: 2 additions & 2 deletions test/test_basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def test_config_no_auth_token(adjust_config):
assert exitcode == 4
assert out == ''
assert err.strip() == \
'Loading config file failed: Neither auth_token nor gateway_token is set in the config.'
"Loading config file failed: Neither 'auth_token' nor 'gateway_token' set"

def test_config_multiple_auth_methods(adjust_config):
"""Test config with auth_token and gateway_token options in client section."""
Expand All @@ -61,7 +61,7 @@ def test_config_multiple_auth_methods(adjust_config):
assert exitcode == 4
assert out == ''
assert err.strip() == \
'Loading config file failed: Both auth_token and gateway_token are set in the config.'
"Loading config file failed: Both 'auth_token' and 'gateway_token' set"

def test_register_and_check_invalid_gateway_token(adjust_config):
"""Test config with invalid gateway_token."""
Expand Down

0 comments on commit 30d2415

Please sign in to comment.