summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2014-06-23 19:07:41 +0200
committerJakub Hrozek <jhrozek@redhat.com>2014-07-01 11:43:34 +0200
commitb0fb84bb4a98d3086b78550c737ef20f63cbac26 (patch)
tree88726493272e521a9ede21c2448842133590d23d /src
parent132d6228d981436c5e1ca3ddf486f95ac77e46b6 (diff)
downloadsssd-b0fb84bb4a98d3086b78550c737ef20f63cbac26.tar.gz
sssd-b0fb84bb4a98d3086b78550c737ef20f63cbac26.tar.xz
sssd-b0fb84bb4a98d3086b78550c737ef20f63cbac26.zip
TESTS: Change how mock_sysdb_user() is implemented
For the purpose of unit tests, it's better to create a user object with a UID and a name. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/tests/cmocka/common_mock_sysdb_objects.c10
-rw-r--r--src/tests/cmocka/common_mock_sysdb_objects.h9
2 files changed, 16 insertions, 3 deletions
diff --git a/src/tests/cmocka/common_mock_sysdb_objects.c b/src/tests/cmocka/common_mock_sysdb_objects.c
index ef050de20..5dc9e4e78 100644
--- a/src/tests/cmocka/common_mock_sysdb_objects.c
+++ b/src/tests/cmocka/common_mock_sysdb_objects.c
@@ -191,3 +191,13 @@ mock_sysdb_group_rfc2307bis(TALLOC_CTX *mem_ctx,
return attrs;
}
+
+struct sysdb_attrs *
+mock_sysdb_user(TALLOC_CTX *mem_ctx,
+ const char *base_dn,
+ uid_t uid,
+ const char *name)
+{
+ return mock_sysdb_object(mem_ctx, base_dn, name,
+ SYSDB_UIDNUM, uid);
+}
diff --git a/src/tests/cmocka/common_mock_sysdb_objects.h b/src/tests/cmocka/common_mock_sysdb_objects.h
index 3ae8405b3..2d00a3f77 100644
--- a/src/tests/cmocka/common_mock_sysdb_objects.h
+++ b/src/tests/cmocka/common_mock_sysdb_objects.h
@@ -35,9 +35,6 @@ _mock_sysdb_object(TALLOC_CTX *mem_ctx,
#define mock_sysdb_object(mem_ctx, base_dn, name, ...) \
_mock_sysdb_object(mem_ctx, base_dn, name, ##__VA_ARGS__, NULL)
-#define mock_sysdb_user(mem_ctx, base_dn, name, ...) \
- mock_sysdb_object(mem_ctx, base_dn, name, ##__VA_ARGS__)
-
struct sysdb_attrs *
mock_sysdb_group_rfc2307bis(TALLOC_CTX *mem_ctx,
const char *base_dn,
@@ -45,4 +42,10 @@ mock_sysdb_group_rfc2307bis(TALLOC_CTX *mem_ctx,
const char *name,
const char **members);
+struct sysdb_attrs *
+mock_sysdb_user(TALLOC_CTX *mem_ctx,
+ const char *base_dn,
+ uid_t uid,
+ const char *name);
+
#endif /* COMMON_MOCK_SYSDB_OBJECTS_H_ */