src/server/plugins/postgresql/pgtest.h

Tue, 26 Apr 2022 15:19:12 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Tue, 26 Apr 2022 15:19:12 +0200
branch
webdav
changeset 316
4090fc1b1c52
parent 315
b608b7aa43a6
child 318
60870dbac94f
permissions
-rw-r--r--

add tests for propfind allprop

/*
 * 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);


/* --------------------------- 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>"


#ifdef __cplusplus
}
#endif

#endif /* PGTEST_H */

mercurial