NetworkManager/src/tests/client
Thomas Haller ea67f48050
cli: handle empty/unset values for "gsm.apn" property
Most string properties can be either %NULL (unset) or a non-empty
string.

For a few properties, like "gsm.apn", also the empty word is a valid
value. That makes it problematic to use from nmcli, because

  nmcli connection modify "$PROFILE" gsm.apn ""

means to reset the default (NULL). How to configure the empty word?
For the APN, "" has a specific meaning, distinct from NULL, so we
need to be able to represent that.

The other problem with nmcli is that

  nmcli -g gsm.apn connection show "$PROFILE"

is supposed to give you a value that you an set again, like

  X="$(nmcli -g gsm.apn connection show "$PROFILE"; echo x)"
  nmcli connection modify "$PROFILE2" gsm.apn "${X%$'\n'x}"

but for %NULL and "" the output would be the same.

The "solution" to that is interpreting "" as NULL (like we always did)
and a non-empty string that contains all whitespace, like a string with
one whitespace less. This way, all values can be expressed.

Note that in case of "gsm.apn", the string is anyway internally
normalized with g_strstrip(), so a string with all whitespace was
not expressable.
2021-05-03 10:11:25 +02:00
..
terminal-colors.d client/tests: move "clients/tests/test-client.py" to "src/tests/client/" 2021-03-15 17:10:55 +01:00
test-client.check-on-disk cli: handle empty/unset values for "gsm.apn" property 2021-05-03 10:11:25 +02:00
meson.build tests/client: run "test-client.py" also for meson 2021-03-15 17:10:56 +01:00
test-client.py cli/tests: add unit test for checking setting/getting of "gsm.apn" 2021-05-03 10:11:24 +02:00
test-client.sh tests/client: rework error handling in "test-client.sh" script 2021-03-19 11:43:19 +01:00