~ubuntu-branches/ubuntu/hardy/lasso/hardy

« back to all changes in this revision

Viewing changes to tests/metadata_tests.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Bienia
  • Date: 2007-07-31 21:35:26 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070731213526-oc6jw5mprcd5tjyy
Tags: 2.0.0-1ubuntu1
* Merge from debian unstable. Remaining changes:
  + debian/control:
    - Modify Maintainer value to match DebianMaintainerField spec.
* debian/rules:
  + Add CC=gcc-4.2 to the configure call else configure won't find jni.h
    from libgcj8-dev.
* configure{,.ac}:
  + Add missing quotes around the value for PHP[45]_LIBS.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Lasso library C unit tests
 
3
 *
 
4
 * Copyright (C) 2006 Entr'ouvert
 
5
 * http://lasso.entrouvert.org
 
6
 *
 
7
 * Authors: See AUTHORS file in top-level directory.
 
8
 *
 
9
 * This program is free software; you can redistribute it and/or modify
 
10
 * it under the terms of the GNU General Public License as published by
 
11
 * the Free Software Foundation; either version 2 of the License, or
 
12
 * (at your option) any later version.
 
13
 *
 
14
 * This program is distributed in the hope that it will be useful,
 
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
 * GNU General Public License for more details.
 
18
 *
 
19
 * You should have received a copy of the GNU General Public License
 
20
 * along with this program; if not, write to the Free Software
 
21
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
22
 */
 
23
 
 
24
#include <stdlib.h>
 
25
#include <string.h>
 
26
 
 
27
#include <check.h>
 
28
 
 
29
#include <lasso/lasso.h>
 
30
#include <lasso/id-ff/provider.h>
 
31
 
 
32
START_TEST(test01_metadata_load_der_certificate_from_x509_cert)
 
33
{
 
34
        LassoProvider *provider = lasso_provider_new(LASSO_PROVIDER_ROLE_SP,
 
35
                        TESTSMETADATADIR "/metadata_01.xml", NULL, NULL);
 
36
        fail_unless(provider != NULL, "Can't load DER certificate from <ds:X509Certificate>");
 
37
}
 
38
END_TEST
 
39
 
 
40
START_TEST(test02_metadata_load_pem_certificate_from_x509_cert)
 
41
{
 
42
        LassoProvider *provider = lasso_provider_new(LASSO_PROVIDER_ROLE_SP,
 
43
                        TESTSMETADATADIR "/metadata_02.xml", NULL, NULL);
 
44
        fail_unless(provider != NULL, "Can't load PEM certificate from <ds:X509Certificate>");
 
45
}
 
46
END_TEST
 
47
 
 
48
START_TEST(test03_metadata_load_der_public_key_from_keyvalue)
 
49
{
 
50
        LassoProvider *provider = lasso_provider_new(LASSO_PROVIDER_ROLE_SP,
 
51
                        TESTSMETADATADIR "/metadata_03.xml", NULL, NULL);
 
52
        fail_unless(provider != NULL, "Can't load DER public key from <ds:KeyValue>");
 
53
}
 
54
END_TEST
 
55
 
 
56
START_TEST(test04_metadata_load_pem_public_key_from_keyvalue)
 
57
{
 
58
        LassoProvider *provider = lasso_provider_new(LASSO_PROVIDER_ROLE_SP,
 
59
                        TESTSMETADATADIR "/metadata_04.xml", NULL, NULL);
 
60
        fail_unless(provider != NULL, "Can't load PEM public key from <ds:KeyValue>");
 
61
}
 
62
END_TEST
 
63
 
 
64
START_TEST(test05_metadata_load_public_key_from_x509_cert)
 
65
{
 
66
        LassoProvider *provider = lasso_provider_new(LASSO_PROVIDER_ROLE_SP,
 
67
                        TESTSMETADATADIR "/metadata_05.xml", NULL, NULL);
 
68
        fail_unless(provider != NULL, "Can't load DER public key from <ds:X509Certificate>");
 
69
}
 
70
END_TEST
 
71
 
 
72
 
 
73
Suite*
 
74
metadata_suite()
 
75
{
 
76
        Suite *s = suite_create("Metadata");
 
77
        TCase *tc_metadata_load_der_certificate_from_x509_cert =
 
78
                tcase_create("Load DER certificate from metadata");
 
79
        TCase *tc_metadata_load_pem_certificate_from_x509_cert =
 
80
                tcase_create("Load PEM certificate from metadata");
 
81
        TCase *tc_metadata_load_der_public_key_from_keyvalue =
 
82
                tcase_create("Load DER public key from <ds:KeyValue>");
 
83
        TCase *tc_metadata_load_pem_public_key_from_keyvalue =
 
84
                tcase_create("Load PEM public key from <ds:KeyValue>");
 
85
        TCase *tc_metadata_load_public_key_from_x509_cert =
 
86
                tcase_create("Load DER public key from <ds:X509Certificate>");
 
87
        suite_add_tcase(s, tc_metadata_load_der_certificate_from_x509_cert);
 
88
        suite_add_tcase(s, tc_metadata_load_pem_certificate_from_x509_cert);
 
89
        suite_add_tcase(s, tc_metadata_load_der_public_key_from_keyvalue);
 
90
        suite_add_tcase(s, tc_metadata_load_pem_public_key_from_keyvalue);
 
91
        suite_add_tcase(s, tc_metadata_load_public_key_from_x509_cert);
 
92
        tcase_add_test(tc_metadata_load_der_certificate_from_x509_cert,
 
93
                test01_metadata_load_der_certificate_from_x509_cert);
 
94
        tcase_add_test(tc_metadata_load_pem_certificate_from_x509_cert,
 
95
                test02_metadata_load_pem_certificate_from_x509_cert);
 
96
        tcase_add_test(tc_metadata_load_der_public_key_from_keyvalue,
 
97
                test03_metadata_load_der_public_key_from_keyvalue);
 
98
        tcase_add_test(tc_metadata_load_pem_public_key_from_keyvalue,
 
99
                test04_metadata_load_pem_public_key_from_keyvalue);
 
100
        tcase_add_test(tc_metadata_load_public_key_from_x509_cert,
 
101
                test05_metadata_load_public_key_from_x509_cert);
 
102
        return s;
 
103
}