mirror of
https://gitlab.gnome.org/GNOME/libsecret.git
synced 2025-01-03 02:28:53 +00:00
tests: Conditionalize session algorithm check in test-session
When compiled without libgcrypt, some of the tests in test-session fails as they expect the session algorithm to be "dh-ietf1024-sha256-aes128-cbc-pkcs7". This adds a build-time conditional to guard against it. Signed-off-by: Daiki Ueno <dueno@src.gnome.org>
This commit is contained in:
parent
564874beb0
commit
0f49b34fa2
@ -29,6 +29,12 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#ifdef WITH_GCRYPT
|
||||||
|
#define SESSION_ALGO "dh-ietf1024-sha256-aes128-cbc-pkcs7"
|
||||||
|
#else
|
||||||
|
#define SESSION_ALGO "plain"
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
SecretService *service;
|
SecretService *service;
|
||||||
} Test;
|
} Test;
|
||||||
@ -73,7 +79,7 @@ test_ensure (Test *test,
|
|||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert_true (ret);
|
g_assert_true (ret);
|
||||||
g_assert_cmpstr (secret_service_get_session_dbus_path (test->service), !=, NULL);
|
g_assert_cmpstr (secret_service_get_session_dbus_path (test->service), !=, NULL);
|
||||||
g_assert_cmpstr (secret_service_get_session_algorithms (test->service), ==, "dh-ietf1024-sha256-aes128-cbc-pkcs7");
|
g_assert_cmpstr (secret_service_get_session_algorithms (test->service), ==, SESSION_ALGO);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -91,14 +97,14 @@ test_ensure_twice (Test *test,
|
|||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert_true (ret);
|
g_assert_true (ret);
|
||||||
g_assert_cmpstr (secret_service_get_session_dbus_path (test->service), !=, NULL);
|
g_assert_cmpstr (secret_service_get_session_dbus_path (test->service), !=, NULL);
|
||||||
g_assert_cmpstr (secret_service_get_session_algorithms (test->service), ==, "dh-ietf1024-sha256-aes128-cbc-pkcs7");
|
g_assert_cmpstr (secret_service_get_session_algorithms (test->service), ==, SESSION_ALGO);
|
||||||
|
|
||||||
path = g_strdup (secret_service_get_session_dbus_path (test->service));
|
path = g_strdup (secret_service_get_session_dbus_path (test->service));
|
||||||
ret = secret_service_ensure_session_sync (test->service, NULL, &error);
|
ret = secret_service_ensure_session_sync (test->service, NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert_true (ret);
|
g_assert_true (ret);
|
||||||
g_assert_cmpstr (secret_service_get_session_dbus_path (test->service), ==, path);
|
g_assert_cmpstr (secret_service_get_session_dbus_path (test->service), ==, path);
|
||||||
g_assert_cmpstr (secret_service_get_session_algorithms (test->service), ==, "dh-ietf1024-sha256-aes128-cbc-pkcs7");
|
g_assert_cmpstr (secret_service_get_session_algorithms (test->service), ==, SESSION_ALGO);
|
||||||
|
|
||||||
g_free (path);
|
g_free (path);
|
||||||
}
|
}
|
||||||
@ -172,7 +178,7 @@ test_ensure_async_aes (Test *test,
|
|||||||
|
|
||||||
g_assert_true (ret);
|
g_assert_true (ret);
|
||||||
g_assert_cmpstr (secret_service_get_session_dbus_path (test->service), !=, NULL);
|
g_assert_cmpstr (secret_service_get_session_dbus_path (test->service), !=, NULL);
|
||||||
g_assert_cmpstr (secret_service_get_session_algorithms (test->service), ==, "dh-ietf1024-sha256-aes128-cbc-pkcs7");
|
g_assert_cmpstr (secret_service_get_session_algorithms (test->service), ==, SESSION_ALGO);
|
||||||
|
|
||||||
g_object_unref (result);
|
g_object_unref (result);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user