diff options
| author | Michael Biebl <biebl@debian.org> | 2016-10-01 00:33:49 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2016-10-01 00:33:49 +0200 |
| commit | 270c4830551c9810ad4e83f9a1db2b1cb946208c (patch) | |
| tree | 5df09188f7e43b70896efb7b6e942e0b130d75d3 /libnm-core/tests/test-keyfile.c | |
| parent | 7514efc2f38c9ace4557d4e69d68e7d380389030 (diff) | |
New upstream version 1.4.2 upstream/1.4.2
Diffstat (limited to 'libnm-core/tests/test-keyfile.c')
| -rw-r--r-- | libnm-core/tests/test-keyfile.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/libnm-core/tests/test-keyfile.c b/libnm-core/tests/test-keyfile.c index ecb7cd5a..b9b211b6 100644 --- a/libnm-core/tests/test-keyfile.c +++ b/libnm-core/tests/test-keyfile.c @@ -27,6 +27,7 @@ #include "nm-setting-connection.h" #include "nm-setting-wired.h" #include "nm-setting-8021x.h" +#include "nm-setting-team.h" #include "nm-utils/nm-test-utils.h" @@ -518,6 +519,54 @@ test_8021x_cert_read (void) CLEAR (&con, &keyfile); } +static void +test_team_conf_read_valid (void) +{ + GKeyFile *keyfile = NULL; + gs_unref_object NMConnection *con = NULL; + NMSettingTeam *s_team; + + con = nmtst_create_connection_from_keyfile ( + "[connection]\n" + "type=team\n" + "interface-name=nm-team1\n" + "[team]\n" + "config={\"foo\":\"bar\"}", + "/test_team_conf_read/valid", NULL); + + g_assert (con); + s_team = nm_connection_get_setting_team (con); + g_assert (s_team); + g_assert_cmpstr (nm_setting_team_get_config (s_team), ==, "{\"foo\":\"bar\"}"); + + CLEAR (&con, &keyfile); +} + +static void +test_team_conf_read_invalid (void) +{ +#if WITH_JANSSON + GKeyFile *keyfile = NULL; + gs_unref_object NMConnection *con = NULL; + NMSettingTeam *s_team; + + con = nmtst_create_connection_from_keyfile ( + "[connection]\n" + "type=team\n" + "interface-name=nm-team1\n" + "[team]\n" + "config={foobar}", + "/test_team_conf_read/invalid", NULL); + + g_assert (con); + s_team = nm_connection_get_setting_team (con); + g_assert (s_team); + g_assert (nm_setting_team_get_config (s_team) == NULL); + + CLEAR (&con, &keyfile); +#endif +} + /******************************************************************************/ NMTST_DEFINE (); @@ -528,6 +577,8 @@ int main (int argc, char **argv) g_test_add_func ("/core/keyfile/test_8021x_cert", test_8021x_cert); g_test_add_func ("/core/keyfile/test_8021x_cert_read", test_8021x_cert_read); + g_test_add_func ("/core/keyfile/test_team_conf_read/valid", test_team_conf_read_valid); + g_test_add_func ("/core/keyfile/test_team_conf_read/invalid", test_team_conf_read_invalid); return g_test_run (); } |