1+ import pytest
12import responses
23
34from scaup .utils .config import Config
45
56SHIPMENT_REQUEST_CONTENTS = {"shipmentId" : 1 , "contact" : {"a" : "b" , "c" : "d" }}
6- SHIPMENT_CONTENTS = {"consignee_address_line_1" : "test" , "consignee_email" : "test@diamond.ac.uk" }
7+ SHIPMENT_CONTENTS = {
8+ "consignee_address_line_1" : "test" ,
9+ "consignee_email" : "test@diamond.ac.uk" ,
10+ }
711
812
913@responses .activate
1014def test_get (client ):
1115 """Should get tracking labels as a PDF"""
12- responses .get (f"{ Config .shipping_service .backend_url } /api/shipment_requests/1/shipments/TO_FACILITY" , status = 404 )
16+ responses .get (
17+ f"{ Config .shipping_service .backend_url } /api/shipment_requests/1/shipments/TO_FACILITY" ,
18+ status = 404 ,
19+ )
1320
1421 resp = client .get ("/shipments/117/tracking-labels" )
1522
@@ -32,6 +39,19 @@ def test_no_top_level_containers(client):
3239 assert resp .status_code == 404
3340
3441
42+ @pytest .mark .noregister
43+ @responses .activate
44+ def test_no_beamline_operator (client ):
45+ """Should return 200 even if beamline operator is missing"""
46+ responses .get (
47+ f"{ Config .ispyb_api .url } /proposals/cm1/sessions/1" ,
48+ json = {"items" : [{"beamLineName" : "m01" , "beamLineOperator" : None }]},
49+ )
50+ resp = client .get ("/shipments/118/tracking-labels" )
51+
52+ assert resp .status_code == 404
53+
54+
3555@responses .activate
3656def test_user_address (client ):
3757 """Should return include to/from address if these are available"""
@@ -40,7 +60,11 @@ def test_user_address(client):
4060 json = SHIPMENT_REQUEST_CONTENTS ,
4161 )
4262
43- responses .get (f"{ Config .shipping_service .backend_url } /api/shipments/1" , json = SHIPMENT_CONTENTS , status = 200 )
63+ responses .get (
64+ f"{ Config .shipping_service .backend_url } /api/shipments/1" ,
65+ json = SHIPMENT_CONTENTS ,
66+ status = 200 ,
67+ )
4468
4569 resp = client .get ("/shipments/117/tracking-labels" )
4670
0 commit comments