aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qmlnetwork/qqmlsslkey/qml/tst_sslkey.qml
blob: 3b4aab2ec6e681b6793e34035fdaa3822a9424b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

import QtQuick
import QtTest
import QtNetwork
import QmlTestUri

Item {
    id: root

    property sslKey keyFirst;
    property sslKey keySecond;

    TestCase {
        name: "qtSslKeyTest"

        function test_1initialization() {
            keyFirst.keyFile = ":/assets/key.pem"
            keyFirst.keyAlgorithm = Ssl.Rsa
            keyFirst.keyFormat = Ssl.Pem
            keyFirst.keyType = Ssl.PrivateKey

            keySecond = keyFirst;
        }

        function test_sslConfigurationFields_data() {
            return [
                        { tag: "key is creatable object",
                            field: typeof keyFirst, answer: "object" },
                        { tag: "keySecond is creatable object",
                            field: typeof keySecond, answer: "object" },

                        // key values
                        { tag: "keyFirst.keyFile == :/assets/key.pem",
                            field: keyFirst.keyFile, answer: ":/assets/key.pem" },
                        { tag: "keyFirst.keyAlgorithm == Ssl.Rsa",
                            field: keyFirst.keyAlgorithm, answer: Ssl.Rsa },
                        { tag: "keyFirst.keyFormat == Ssl.Pem",
                            field: keyFirst.keyFormat, answer: Ssl.Pem },
                        { tag: "keyFirst.keyType == Ssl.PrivateKey",
                            field: keyFirst.keyType, answer: Ssl.PrivateKey },

                        // keySecond values
                        { tag: "keySecond.keyFile == :/assets/key.pem",
                            field: keySecond.keyFile, answer: ":/assets/key.pem" },
                        { tag: "keySecond.keyAlgorithm == Ssl.Rsa",
                            field: keySecond.keyAlgorithm, answer: Ssl.Rsa },
                        { tag: "keySecond.keyFormat == Ssl.Pem",
                            field: keySecond.keyFormat, answer: Ssl.Pem },
                        { tag: "keySecond.keyType == Ssl.PrivateKey",
                            field: keySecond.keyType, answer: Ssl.PrivateKey }
                    ]
        }

        function test_sslConfigurationFields(data) {
            compare(data.field, data.answer)
        }
    }
}