conftest.py 4.01 KB
Newer Older
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 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212
import pytest


@pytest.fixture(params=[
    "-----BEGIN CERTIFICATE REQUEST-----\n"
    "MIHoMIGOAgEAMBsxGTAXBgNVBAMMEDAwMDAwMDBBMDAwMDAxRjMwWTATBgcqhkjO\n"
    "PQIBBggqhkjOPQMBBwNCAAQo+Cq6N6QAu99pDw3GJGQ0NZIDnT/P9fU2FePZJVjU\n"
    "o2obmdqZ/uRY8IeQOk3JvpoHM2o0621QIYvpjxxbOQSwoBEwDwYJKoZIhvcNAQkO\n"
    "MQIwADAKBggqhkjOPQQDAgNJADBGAiEA9uJbjUc8CI2BAt7IO6LI6han20G2Ix9T\n"
    "4mw2hEu3feECIQCb1yBuPIykwP896qq5ngESgDOi+AWUzcdVZpOMfVlIlg==\n"
    "-----END CERTIFICATE REQUEST-----\n",
])
def good_csr(request):
    return request.param


@pytest.fixture(params=[""])
def bad_csr(request):
    return request.param


@pytest.fixture(params=[
    (
        "-----BEGIN CERTIFICATE REQUEST-----\n"
        "MIHoMIGOAgEAMBsxGTAXBgNVBAMMEDAwMDAwMDBBMDAwMDAxRjMwWTATBgcqhkjO\n"
        "PQIBBggqhkjOPQMBBwNCAAQo+Cq6N6QAu99pDw3GJGQ0NZIDnT/P9fU2FePZJVjU\n"
        "o2obmdqZ/uRY8IeQOk3JvpoHM2o0621QIYvpjxxbOQSwoBEwDwYJKoZIhvcNAQkO\n"
        "MQIwADAKBggqhkjOPQQDAgNJADBGAiEA9uJbjUc8CI2BAt7IO6LI6han20G2Ix9T\n"
        "4mw2hEu3feECIQCb1yBuPIykwP896qq5ngESgDOi+AWUzcdVZpOMfVlIlg==\n"
        "-----END CERTIFICATE REQUEST-----\n",
        "0000000A000001F3",
    ),
])
def valid_csr_sn_sets(request):
    return request.param


@pytest.fixture(params=[
    "get_key",
    "0000000A000001F4",
    "1000000000000000",
    ""
])
def bad_sn_atsha(request):
    return request.param


@pytest.fixture(params=[
    "0000000A000001F3",
])
def good_sn_atsha(request):
    return request.param


@pytest.fixture(params=[
    "get_cert",
    "auth",
])
def good_req_types(request):
    return request.param


@pytest.fixture(params=[
    "get_certs",
    "",
    " ",
    None,
])
def bad_req_types(request):
    return request.param


@pytest.fixture(params=[
    ["renew"],
    [],
])
def good_flags(request):
    return request.param


@pytest.fixture(params=[
    ["renw"],
    [""],
    [" "],
    [None],
])
def bad_flags(request):
    return request.param


@pytest.fixture(params=[
    "atsha204",
])
def good_auth_types(request):
    return request.param


@pytest.fixture(params=[
    "atsha",
    "",
    " ",
    None,
    #  TODO: improve cert-spi so these lines can ba added to tests
    #  ["atsha"],
    #  ["atsha204"],
    #  [],
])
def bad_auth_types(request):
    return request.param


@pytest.fixture(params=[
    "06d2bce6a9a1423629e93d451e51f156c6f9c556e495ce6506b2f93ba7e9a5c0",
    "adc619eeb5f1d98873c42d19d69e9cf85e84080b54d8b565dc7e789ce9542772",
    "",
])
def good_sid(request):
    return request.param


@pytest.fixture(params=[
    "atsha",
    "Adc619eeb5f1d98873c42d19d69e9cf85e84080b54d8b565dc7e789ce9542772",
    "dc619eeb5f1d98873c42d19d69e9cf85e84080b54d8b565dc7e789ce9542772",
    "adc619eeb5f1d98873c42d19d69e9cf85e84080b54d8b565dc7e789ce954277",
    " ",
    #  TODO: improve cert-spi so these lines can ba added to tests
    #  ["adc619eeb5f1d98873c42d19d69e9cf85e84080b54d8b565dc7e789ce9542772"],
    #  None,
    #  [],
])
def bad_sid(request):
    return request.param


@pytest.fixture(params=[
    {
        "auth_type",
        "nonce",
        "digest",
        "csr_str",
        "flags",
    }
])
def good_sessions(request):
    return request.param


@pytest.fixture(params=[
    {
        "auth_type",
        "nonce",
        "digest",
        "csr_str",
        "",
    },
    {
        "auth_type",
        "nonce",
        "digest",
        "csr_str",
        "flagss",
    },
    {
        "auth_type",
        "nonce",
        "digest",
        "csr_str",
    },
    {}
])
def bad_sessions(request):
    return request.param


@pytest.fixture(params=[
    (
        "status",
    ),
    (
        "status",
    )
])
def good_auth_state(request):
    return request.param


@pytest.fixture(params=[
    (
        "statu",
        "echo"
    ),
    (
        "",
        "echo"
    ),
    #  ( #  TODO: improve cert-spi so these lines can ba added to tests
    #     "status",
    #     "echo"
    #  ),
    #  (
    #     "status",
    #     "status"
    #  ),
    (
        "",
    ),
    (
    ),
])
def bad_auth_state(request):
    return request.param