mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-06 03:28:03 +02:00
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:
parent
28169725d7
commit
542f1fe3c9
1 changed files with 44 additions and 0 deletions
|
|
@ -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 ();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue