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
|
from __future__ import annotations
import pytest
@pytest.fixture()
def certificate_response():
return {
"certificate": {
"id": 2323,
"name": "My Certificate",
"type": "managed",
"labels": {},
"certificate": "-----BEGIN CERTIFICATE-----\n...",
"created": "2019-01-08T12:10:00+00:00",
"not_valid_before": "2019-01-08T10:00:00+00:00",
"not_valid_after": "2019-07-08T09:59:59+00:00",
"domain_names": ["example.com", "webmail.example.com", "www.example.com"],
"fingerprint": "03:c7:55:9b:2a:d1:04:17:09:f6:d0:7f:18:34:63:d4:3e:5f",
"status": {
"issuance": "failed",
"renewal": "scheduled",
"error": {"code": "error_code", "message": "error message"},
},
"used_by": [{"id": 42, "type": "server"}],
}
}
@pytest.fixture()
def create_managed_certificate_response():
return {
"certificate": {
"id": 2323,
"name": "My Certificate",
"type": "managed",
"labels": {},
"certificate": "-----BEGIN CERTIFICATE-----\n...",
"created": "2019-01-08T12:10:00+00:00",
"not_valid_before": "2019-01-08T10:00:00+00:00",
"not_valid_after": "2019-07-08T09:59:59+00:00",
"domain_names": ["example.com", "webmail.example.com", "www.example.com"],
"fingerprint": "03:c7:55:9b:2a:d1:04:17:09:f6:d0:7f:18:34:63:d4:3e:5f",
"status": {"issuance": "pending", "renewal": "scheduled", "error": None},
"used_by": [{"id": 42, "type": "load_balancer"}],
},
"action": {
"id": 14,
"command": "issue_certificate",
"status": "success",
"progress": 100,
"started": "2021-01-30T23:55:00+00:00",
"finished": "2021-01-30T23:57:00+00:00",
"resources": [{"id": 896, "type": "certificate"}],
"error": {"code": "action_failed", "message": "Action failed"},
},
}
@pytest.fixture()
def two_certificates_response():
return {
"certificates": [
{
"id": 2323,
"name": "My Certificate",
"labels": {},
"type": "uploaded",
"certificate": "-----BEGIN CERTIFICATE-----\n...",
"created": "2019-01-08T12:10:00+00:00",
"not_valid_before": "2019-01-08T10:00:00+00:00",
"not_valid_after": "2019-07-08T09:59:59+00:00",
"domain_names": [
"example.com",
"webmail.example.com",
"www.example.com",
],
"fingerprint": "03:c7:55:9b:2a:d1:04:17:09:f6:d0:7f:18:34:63:d4:3e:5f",
"status": None,
"used_by": [{"id": 42, "type": "load_balancer"}],
},
{
"id": 2324,
"name": "My website cert",
"labels": {},
"type": "uploaded",
"certificate": "-----BEGIN CERTIFICATE-----\n...",
"created": "2019-01-08T12:10:00+00:00",
"not_valid_before": "2019-01-08T10:00:00+00:00",
"not_valid_after": "2019-07-08T09:59:59+00:00",
"domain_names": [
"example.com",
"webmail.example.com",
"www.example.com",
],
"fingerprint": "03:c7:55:9b:2a:d1:04:17:09:f6:d0:7f:18:34:63:d4:3e:5f",
"status": None,
"used_by": [{"id": 42, "type": "load_balancer"}],
},
]
}
@pytest.fixture()
def one_certificates_response():
return {
"certificates": [
{
"id": 2323,
"name": "My Certificate",
"labels": {},
"type": "uploaded",
"certificate": "-----BEGIN CERTIFICATE-----\n...",
"created": "2019-01-08T12:10:00+00:00",
"not_valid_before": "2019-01-08T10:00:00+00:00",
"not_valid_after": "2019-07-08T09:59:59+00:00",
"domain_names": [
"example.com",
"webmail.example.com",
"www.example.com",
],
"fingerprint": "03:c7:55:9b:2a:d1:04:17:09:f6:d0:7f:18:34:63:d4:3e:5f",
"status": None,
"used_by": [{"id": 42, "type": "load_balancer"}],
}
]
}
@pytest.fixture()
def response_update_certificate():
return {
"certificate": {
"id": 2323,
"name": "New name",
"labels": {},
"type": "uploaded",
"certificate": "-----BEGIN CERTIFICATE-----\n...",
"created": "2019-01-08T12:10:00+00:00",
"not_valid_before": "2019-01-08T10:00:00+00:00",
"not_valid_after": "2019-07-08T09:59:59+00:00",
"domain_names": ["example.com", "webmail.example.com", "www.example.com"],
"fingerprint": "03:c7:55:9b:2a:d1:04:17:09:f6:d0:7f:18:34:63:d4:3e:5f",
"status": None,
"used_by": [{"id": 42, "type": "load_balancer"}],
}
}
@pytest.fixture()
def response_get_actions():
return {
"actions": [
{
"id": 13,
"command": "change_protection",
"status": "success",
"progress": 100,
"started": "2016-01-30T23:55:00+00:00",
"finished": "2016-01-30T23:56:00+00:00",
"resources": [{"id": 14, "type": "certificate"}],
"error": {"code": "action_failed", "message": "Action failed"},
}
]
}
@pytest.fixture()
def response_retry_issuance_action():
return {
"action": {
"id": 14,
"command": "issue_certificate",
"status": "running",
"progress": 0,
"started": "2016-01-30T23:50+00:00",
"finished": None,
"resources": [{"id": 42, "type": "certificate"}],
"error": {"code": "action_failed", "message": "Action failed"},
}
}
|