keyfile/tests: assert against auto generated UUID for keyfile

The algorithm for generating the UUID must be stable. Assert
against that.

(cherry picked from commit 2e0a95530f)
This commit is contained in:
Thomas Haller 2018-10-03 00:02:30 +02:00
parent f8f7b3d160
commit 12f78af0ec

View file

@ -2150,12 +2150,15 @@ static void
test_read_missing_id_uuid (void)
{
gs_unref_object NMConnection *connection = NULL;
gs_free char *expected_uuid = NULL;
const char *FILENAME = TEST_KEYFILES_DIR"/Test_Missing_ID_UUID";
connection = keyfile_read_connection_from_file (TEST_KEYFILES_DIR"/Test_Missing_ID_UUID");
expected_uuid = _nm_utils_uuid_generate_from_strings ("keyfile", FILENAME, NULL);
connection = keyfile_read_connection_from_file (FILENAME);
/* Ensure the ID and UUID properties are there */
g_assert_cmpstr (nm_connection_get_id (connection), ==, "Test_Missing_ID_UUID");
g_assert (nm_connection_get_uuid (connection));
g_assert_cmpstr (nm_connection_get_uuid (connection), ==, expected_uuid);
}
static void