src/server/plugins/postgresql/pgtest.h

Sun, 01 May 2022 10:56:36 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 01 May 2022 10:56:36 +0200
branch
webdav
changeset 320
a40f7af1b670
parent 318
60870dbac94f
child 324
44cf877b3d9f
permissions
-rw-r--r--

fix memory initialization for WebdavProperty in webdav tests

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/* 
 * File:   pgtest.h
 * Author: olaf
 *
 * Created on 16. April 2022, 14:37
 */

#ifndef PGTEST_H
#define PGTEST_H

#include <ucx/test.h>
#include <ucx/map.h>
#include <libxml/tree.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef struct TestMultistatus {
    UcxMempool *mp;
    xmlDoc *doc;
    UcxMap *responses;
} TestMultistatus;
    
typedef struct TestResponse {
    char *href;
    UcxMap *properties;
} TestResponse;

typedef struct TestProperty {
    char *prefix;
    char *namespace;
    char *name;
    char *lang;
    char *value;
    xmlNode *node;
    int status;
} TestProperty;

TestMultistatus* test_parse_multistatus(const char *space, size_t size);
void test_multistatus_destroy(TestMultistatus *ms);

UCX_TEST(test_pg_conn);

UCX_TEST(test_pg_vfs_open);
UCX_TEST(test_pg_vfs_io);
UCX_TEST(test_pg_vfs_stat);
UCX_TEST(test_pg_vfs_mkdir);
UCX_TEST(test_pg_vfs_unlink);
UCX_TEST(test_pg_vfs_rmdir);

UCX_TEST(test_pg_webdav_create_from_resdata);
UCX_TEST(test_pg_prepare_tests);
UCX_TEST(test_pg_webdav_propfind);
UCX_TEST(test_pg_webdav_propfind_allprop);
UCX_TEST(test_pg_webdav_proppatch_set);


/* --------------------------- PROPFIND --------------------------- */

#define PG_TEST_PROPFIND1 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \
        <D:propfind xmlns:D=\"DAV:\" xmlns:X=\"http://example.com/\" > \
            <D:prop> \
                <D:displayname/> \
                <D:getcontentlength/> \
                <D:getcontenttype/> \
                <D:getlastmodified/> \
                <D:creationdate/> \
                <D:resourcetype/> \
                <D:getetag/> \
            </D:prop> \
        </D:propfind>"

#define PG_TEST_PROPFIND2 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \
        <D:propfind xmlns:D=\"DAV:\" xmlns:X=\"http://example.com/\" > \
            <D:prop> \
                <D:displayname/> \
                <D:getcontentlength/> \
                <D:getcontenttype/> \
                <D:getlastmodified/> \
                <D:creationdate/> \
                <D:resourcetype/> \
                <D:getetag/> \
                <X:test /> \
                <X:prop2 /> \
            </D:prop> \
        </D:propfind>"

#define PG_TEST_ALLPROP "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \
        <D:propfind xmlns:D=\"DAV:\" xmlns:X=\"http://example.com/\" > \
            <D:allprop/> \
        </D:propfind>"

#define PG_TEST_PROPPATCH1 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \
        <D:propertyupdate xmlns:D=\"DAV:\" xmlns:X=\"http://example.com/\"> \
            <D:set> \
                <D:prop><X:test>test</X:test><X:author>name</X:author></D:prop> \
            </D:set> \
        </D:propertyupdate>"

#ifdef __cplusplus
}
#endif

#endif /* PGTEST_H */

mercurial