@@ -74,11 +74,23 @@ def test_get_cert_by_thumbprint(self):
74
74
self .assertIsNotNone (cert )
75
75
self .assertEqual (
76
76
cert .subject .as_string (),
77
- 'E=support@cryptopro.ru, C=RU, L=Moscow, O=CRYPTO-PRO LLC, CN=CRYPTO-PRO Test Center 2'
77
+ '\r \n ' .join ([
78
+ 'E=support@cryptopro.ru' ,
79
+ 'C=RU' ,
80
+ 'L=Moscow' ,
81
+ 'O=CRYPTO-PRO LLC' ,
82
+ 'CN=CRYPTO-PRO Test Center 2'
83
+ ])
78
84
)
79
85
self .assertEqual (
80
86
cert .issuer .as_string (),
81
- 'E=support@cryptopro.ru, C=RU, L=Moscow, O=CRYPTO-PRO LLC, CN=CRYPTO-PRO Test Center 2'
87
+ '\r \n ' .join ([
88
+ 'E=support@cryptopro.ru' ,
89
+ 'C=RU' ,
90
+ 'L=Moscow' ,
91
+ 'O=CRYPTO-PRO LLC' ,
92
+ 'CN=CRYPTO-PRO Test Center 2'
93
+ ])
82
94
)
83
95
self .assertEqual (
84
96
cert .valid_from ,
@@ -120,12 +132,24 @@ def test_get_signer_certificate_from_signature(self):
120
132
121
133
self .assertEqual (
122
134
cert .issuer .as_string (),
123
- 'E=support@cryptopro.ru, C=RU, L=Moscow, O=CRYPTO-PRO LLC, CN=CRYPTO-PRO Test Center 2'
135
+ '\r \n ' .join ([
136
+ 'E=support@cryptopro.ru' ,
137
+ 'C=RU' ,
138
+ 'L=Moscow' ,
139
+ 'O=CRYPTO-PRO LLC' ,
140
+ 'CN=CRYPTO-PRO Test Center 2'
141
+ ])
124
142
)
125
143
self .assertEqual (
126
144
cert .subject .as_string (),
127
- 'CN=Иванов Иван Иванович, INN=123456789047, OGRN=1123300000053, SNILS=12345678901, STREET="Улица, дом", '
128
- 'L=Город'
145
+ '\r \n ' .join ([
146
+ 'CN=Иванов Иван Иванович' ,
147
+ 'INN=123456789047' ,
148
+ 'OGRN=1123300000053' ,
149
+ 'SNILS=12345678901' ,
150
+ 'STREET="Улица, дом"' ,
151
+ 'L=Город'
152
+ ])
129
153
)
130
154
subject_dict = cert .subject .as_dict ()
131
155
self .assertEqual (subject_dict ['CN' ], 'Иванов Иван Иванович' )
@@ -143,32 +167,34 @@ def test_get_signer_certificate_from_signature(self):
143
167
self .assertEqual (cert .subject .city , 'Город' )
144
168
145
169
def test_inn_original (self ):
146
- signature_content = self ._get_content (os .path .join (files_dir , 'signatures' , 'doc.txt.sgn' ))
147
- cert = self .sdk .get_signer_cert_from_signature (signature_content )
148
- subject_list = cert .subject .cert_name .split (', ' )
149
- subject_list [1 ] = 'INN=003456789047'
150
- subject_string = ', ' .join (subject_list )
170
+ subject_string = '\r \n ' .join (['INN=003456789047' ])
151
171
subject = Subject (subject_string )
152
172
self .assertEqual (subject .inn_original , '003456789047' )
153
173
self .assertEqual (subject .inn , '3456789047' )
154
174
155
175
# def test_get_signer_alt_name_from_signature(self):
156
- # signature_content = self._get_content(os.path.join(files_dir, 'signatures', 'test .txt.sig'))
176
+ # signature_content = self._get_content(os.path.join(files_dir, 'signatures', 'test_alt_name .txt.sig'))
157
177
# cert = self.sdk.get_signer_cert_from_signature(signature_content)
158
178
# self.assertDictEqual(cert.alt_name.as_dict(), {'OGRNIP': '123456789012345'})
159
179
160
180
161
181
class TestCertName (unittest .TestCase ):
162
182
def test_subject_as_string (self ):
163
- cert_name = CertName ('CN=Иванов Иван Иванович, INN=1234567890, 2.5.4.5="#1303323739"' )
183
+ cert_name = CertName ('\r \n ' .join ([
184
+ 'CN=Иванов Иван Иванович' ,
185
+ 'INN=1234567890' ,
186
+ 'STREET=ул. Горшкова, дом 4, 1' ,
187
+ '2.5.4.5="#1303323739"'
188
+ ]))
164
189
cert_name_dict = cert_name .as_dict ()
165
190
self .assertDictEqual (
166
- cert_name_dict ,
167
191
{
168
192
'CN' : 'Иванов Иван Иванович' ,
169
193
'INN' : '1234567890' ,
170
- '2.5.4.5' : '"#1303323739"'
171
- }
194
+ '2.5.4.5' : '"#1303323739"' ,
195
+ 'STREET' : 'ул. Горшкова, дом 4, 1' ,
196
+ },
197
+ cert_name_dict ,
172
198
)
173
199
174
200
0 commit comments