test: nm_connection_verify() sets the interface-name to virtual_iface_name.

Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
Thomas Haller 2014-01-10 18:05:30 +01:00
parent 28169725d7
commit 542f1fe3c9

View file

@ -2484,6 +2484,49 @@ test_setting_old_uuid (void)
g_assert (success == TRUE);
}
/*
* nm_connection_verify() modifies the connection by setting
* the interface-name property to the virtual_iface_name of
* the type specific settings.
*
* It would be preferable of verify() not to touch the connection,
* but as it is now, stick with it and test it.
**/
static void
test_connection_verify_sets_interface_name (void)
{
NMConnection *con;
NMSettingConnection *s_con;
NMSettingBond *s_bond;
GError *error = NULL;
gboolean success;
s_con = (NMSettingConnection *) nm_setting_connection_new ();
g_object_set (G_OBJECT (s_con),
NM_SETTING_CONNECTION_ID, "test1",
NM_SETTING_CONNECTION_UUID, "22001632-bbb4-4616-b277-363dce3dfb5b",
NM_SETTING_CONNECTION_TYPE, NM_SETTING_BOND_SETTING_NAME,
NULL);
s_bond = (NMSettingBond *) nm_setting_bond_new ();
g_object_set (G_OBJECT (s_bond),
NM_SETTING_BOND_INTERFACE_NAME, "bond-x",
NULL);
con = nm_connection_new ();
nm_connection_add_setting (con, NM_SETTING (s_con));
nm_connection_add_setting (con, NM_SETTING (s_bond));
g_assert_cmpstr (nm_connection_get_interface_name (con), ==, NULL);
/* for backward compatiblity, normalizes the interface name */
success = nm_connection_verify (con, &error);
g_assert (success && !error);
g_assert_cmpstr (nm_connection_get_interface_name (con), ==, "bond-x");
g_object_unref (con);
}
NMTST_DEFINE ();
int main (int argc, char **argv)
@ -2521,6 +2564,7 @@ int main (int argc, char **argv)
test_connection_replace_settings ();
test_connection_replace_settings_from_connection ();
test_connection_new_from_hash ();
test_connection_verify_sets_interface_name ();
test_setting_connection_permissions_helpers ();
test_setting_connection_permissions_property ();