@@ -39,8 +39,6 @@ def test_with_manual_address(self):
39
39
'address_same_as_company' : False ,
40
40
'address_1' : 'Foo st.' ,
41
41
'address_2' : 'adr 2' ,
42
- 'address_3' : 'adr 3' ,
43
- 'address_4' : 'adr 4' ,
44
42
'address_town' : 'London' ,
45
43
'address_county' : 'London' ,
46
44
'address_country' : {
@@ -82,8 +80,6 @@ def test_with_manual_address(self):
82
80
'address_same_as_company' : False ,
83
81
'address_1' : 'Foo st.' ,
84
82
'address_2' : 'adr 2' ,
85
- 'address_3' : 'adr 3' ,
86
- 'address_4' : 'adr 4' ,
87
83
'address_town' : 'London' ,
88
84
'address_county' : 'London' ,
89
85
'address_country' : {
@@ -125,8 +121,6 @@ def test_with_address_same_as_company(self):
125
121
assert response_data ['address_same_as_company' ]
126
122
assert not response_data ['address_1' ]
127
123
assert not response_data ['address_2' ]
128
- assert not response_data ['address_3' ]
129
- assert not response_data ['address_4' ]
130
124
assert not response_data ['address_country' ]
131
125
assert not response_data ['address_county' ]
132
126
assert not response_data ['address_postcode' ]
@@ -156,8 +150,6 @@ def test_defaults(self):
156
150
assert not response_data ['email_alternative' ]
157
151
assert not response_data ['address_1' ]
158
152
assert not response_data ['address_2' ]
159
- assert not response_data ['address_3' ]
160
- assert not response_data ['address_4' ]
161
153
assert not response_data ['address_town' ]
162
154
assert not response_data ['address_county' ]
163
155
assert not response_data ['address_country' ]
@@ -205,7 +197,7 @@ def test_fails_without_address(self):
205
197
}, format = 'json' )
206
198
207
199
assert response .status_code == status .HTTP_400_BAD_REQUEST
208
- assert response .data [ 'errors' ] == {
200
+ assert response .data == {
209
201
'address_same_as_company' : ['Please select either address_same_as_company or enter an address manually.' ]
210
202
}
211
203
@@ -226,7 +218,7 @@ def test_fails_with_only_partial_manual_address(self):
226
218
}, format = 'json' )
227
219
228
220
assert response .status_code == status .HTTP_400_BAD_REQUEST
229
- assert response .data [ 'errors' ] == {
221
+ assert response .data == {
230
222
'address_country' : ['This field may not be null.' ],
231
223
'address_town' : ['This field may not be null.' ]
232
224
}
@@ -250,7 +242,7 @@ def test_fails_with_contact_preferences_not_set(self):
250
242
}, format = 'json' )
251
243
252
244
assert response .status_code == status .HTTP_400_BAD_REQUEST
253
- assert response .data [ 'errors' ] == {
245
+ assert response .data == {
254
246
'contactable_by_email' : [
255
247
'A contact should have at least one way of being contacted. '
256
248
'Please select either email or phone, or both'
@@ -286,8 +278,6 @@ def test_patch(self):
286
278
address_same_as_company = False ,
287
279
address_1 = 'Foo st.' ,
288
280
address_2 = 'adr 2' ,
289
- address_3 = 'adr 3' ,
290
- address_4 = 'adr 4' ,
291
281
address_town = 'London' ,
292
282
address_county = 'London' ,
293
283
address_country_id = constants .Country .united_kingdom .value .id ,
@@ -332,8 +322,6 @@ def test_patch(self):
332
322
'address_same_as_company' : False ,
333
323
'address_1' : 'Foo st.' ,
334
324
'address_2' : 'adr 2' ,
335
- 'address_3' : 'adr 3' ,
336
- 'address_4' : 'adr 4' ,
337
325
'address_town' : 'London' ,
338
326
'address_county' : 'London' ,
339
327
'address_country' : {
@@ -387,8 +375,8 @@ def test_archive_with_reason(self):
387
375
assert response .data ['archived_reason' ] == 'foo'
388
376
assert response .data ['id' ] == contact .pk
389
377
390
- def test_unarchive (self ):
391
- """Test unarchive contact."""
378
+ def test_unarchive_get (self ):
379
+ """Test unarchiving a contact using GET ."""
392
380
contact = ContactFactory (archived = True , archived_reason = 'foo' )
393
381
url = reverse ('api-v3:contact:unarchive' , kwargs = {'pk' : contact .pk })
394
382
response = self .api_client .get (url )
@@ -398,6 +386,17 @@ def test_unarchive(self):
398
386
assert response .data ['archived_reason' ] == ''
399
387
assert response .data ['id' ] == contact .pk
400
388
389
+ def test_unarchive_post (self ):
390
+ """Test unarchiving a contact using POST."""
391
+ contact = ContactFactory (archived = True , archived_reason = 'foo' )
392
+ url = reverse ('api-v3:contact:unarchive' , kwargs = {'pk' : contact .pk })
393
+ response = self .api_client .post (url )
394
+
395
+ assert not response .data ['archived' ]
396
+ assert not response .data ['archived_by' ]
397
+ assert response .data ['archived_reason' ] == ''
398
+ assert response .data ['id' ] == contact .pk
399
+
401
400
402
401
class ViewContactTestCase (LeelooTestCase ):
403
402
"""View contact test case."""
@@ -423,8 +422,6 @@ def test_view(self):
423
422
address_same_as_company = False ,
424
423
address_1 = 'Foo st.' ,
425
424
address_2 = 'adr 2' ,
426
- address_3 = 'adr 3' ,
427
- address_4 = 'adr 4' ,
428
425
address_town = 'London' ,
429
426
address_county = 'London' ,
430
427
address_country_id = constants .Country .united_kingdom .value .id ,
@@ -466,8 +463,6 @@ def test_view(self):
466
463
'address_same_as_company' : False ,
467
464
'address_1' : 'Foo st.' ,
468
465
'address_2' : 'adr 2' ,
469
- 'address_3' : 'adr 3' ,
470
- 'address_4' : 'adr 4' ,
471
466
'address_town' : 'London' ,
472
467
'address_county' : 'London' ,
473
468
'address_country' : {
0 commit comments