Otherwise we would need to setup ubus infrastructure etc.
Signed-off-by: Petr Štetiar <ynezz@true.cz>
TARGET_LINK_LIBRARIES(cgi-io cgi-lib ${ubox} ${ubus})
IF(UNIT_TESTING)
+ ADD_DEFINITIONS(-DUNIT_TESTING)
ENABLE_TESTING()
ADD_SUBDIRECTORY(tests)
ENDIF()
int tempfd;
};
+static struct state st;
+
+#ifndef UNIT_TESTING
+
enum {
SES_ACCESS,
__SES_MAX,
[SES_ACCESS] = { .name = "access", .type = BLOBMSG_TYPE_BOOL },
};
-
-static struct state st;
-
static void
session_access_cb(struct ubus_request *req, int type, struct blob_attr *msg)
{
if (tb[SES_ACCESS])
*allow = blobmsg_get_bool(tb[SES_ACCESS]);
}
+#endif
static bool
session_access(const char *sid, const char *scope, const char *obj, const char *func)
{
+#ifdef UNIT_TESTING
+ return true;
+#else
uint32_t id;
bool allow = false;
struct ubus_context *ctx;
ubus_free(ctx);
return allow;
+#endif
}
static char *