@@ -10,9 +10,18 @@ class TestIdBatch(Common):
10
10
@classmethod
11
11
def setUpClass (cls ):
12
12
super ().setUpClass ()
13
- cls ._test_queue_1 = cls ._create_test_queue (cls ._test_individual_1 .id )
14
- cls ._test_queue_2 = cls ._create_test_queue (cls ._test_individual_2 .id )
15
- cls ._test_queue_3 = cls ._create_test_queue (cls ._test_individual_3 .id )
13
+ cls .id_type = (
14
+ cls .env ["g2p.id.type" ]
15
+ .create (
16
+ {
17
+ "name" : "Test ID Type" ,
18
+ }
19
+ )
20
+ .id
21
+ )
22
+ cls ._test_queue_1 = cls ._create_test_queue (cls ._test_individual_1 .id , cls .id_type )
23
+ cls ._test_queue_2 = cls ._create_test_queue (cls ._test_individual_2 .id , cls .id_type )
24
+ cls ._test_queue_3 = cls ._create_test_queue (cls ._test_individual_3 .id , cls .id_type )
16
25
cls .test_batch = cls .env ["spp.print.queue.batch" ].create (
17
26
{
18
27
"name" : "TEST BATCH 01" ,
@@ -49,32 +58,8 @@ def test_02_mark_as_done_raise_error_01(self):
49
58
with self .assertRaisesRegex (ValidationError , "Some IDs are not generated" ):
50
59
self .test_batch .mark_as_done (self .test_batch )
51
60
52
- def test_03_mark_as_done_raise_error_02 (self ):
53
- self .test_batch .queued_ids .write ({"status" : "generated" })
54
- with self .assertRaisesRegex (ValidationError , "No Auth Token or API URL" ):
55
- self .test_batch .mark_as_done (self .test_batch )
56
-
57
- @patch ("requests.post" )
58
- def test_04_mark_as_done_response_403 (self , mock_post ):
59
- self .test_batch .queued_ids .write ({"status" : "generated" })
60
- template_batch_print = self .env .ref ("spp_idqueue.id_template_batch_print" )
61
- template_batch_print .write (
62
- {
63
- "auth_token" : "AUTHENTIFICATION-TOKEN" ,
64
- "api_url" : "http://127.0.0.1:8080/" ,
65
- }
66
- )
67
- mock_post .return_value = Mock (status_code = 403 )
68
- self .test_batch .mark_as_done (self .test_batch )
69
- self .assertEqual (
70
- self .test_batch .merge_status ,
71
- "error_sending" ,
72
- "Merge status should be error, since the response status code is 403!" ,
73
- )
74
- self .assertEqual (self .test_batch .status , "generated" , "Status should be generated!" )
75
-
76
61
@patch ("requests.post" )
77
- def test_04_mark_as_done_response_200 (self , mock_post ):
62
+ def test_03_mark_as_done_response_200 (self , mock_post ):
78
63
self .test_batch .queued_ids .write ({"status" : "generated" })
79
64
template_batch_print = self .env .ref ("spp_idqueue.id_template_batch_print" )
80
65
template_batch_print .write (
@@ -87,17 +72,17 @@ def test_04_mark_as_done_response_200(self, mock_post):
87
72
self .test_batch .mark_as_done (self .test_batch )
88
73
self .assertEqual (
89
74
self .test_batch .merge_status ,
90
- "sent " ,
91
- "Merge status should be sent , since the response status code is 200 !" ,
75
+ "merged " ,
76
+ "Merge status should be merged , since this is not idpass !" ,
92
77
)
93
78
self .assertEqual (self .test_batch .status , "generated" , "Status should be generated!" )
94
79
95
- def test_05_print_batch (self ):
80
+ def test_04_print_batch (self ):
96
81
self .assertEqual (self .test_batch .status , "new" , "Status should be new!" )
97
82
self .test_batch .print_batch ()
98
83
self .assertEqual (self .test_batch .status , "printing" , "Status should be printing!" )
99
84
100
- def test_06_batch_printed (self ):
85
+ def test_05_batch_printed (self ):
101
86
self .assertEqual (self .test_batch .status , "new" , "Status should be new!" )
102
87
self .assertListEqual (
103
88
self .test_batch .queued_ids .mapped ("status" ),
@@ -121,7 +106,7 @@ def test_06_batch_printed(self):
121
106
"Test Queue status should be `printed`!" ,
122
107
)
123
108
124
- def test_07_batch_distributed (self ):
109
+ def test_06_batch_distributed (self ):
125
110
self .assertEqual (self .test_batch .status , "new" , "Status should be new!" )
126
111
self .assertListEqual (
127
112
self .test_batch .queued_ids .mapped ("status" ),
0 commit comments