@@ -162,3 +162,103 @@ def test_model_not_found(self, mock_update_store_model):
162162 self .assertEqual (response .status_code , 500 )
163163 self .assertFalse (data ["success" ])
164164 self .assertEqual (data ["message" ], "Model not found" )
165+
166+
167+ class TestGetRemodelAllowlist (TestModelServiceEndpoints ):
168+ @patch (
169+ "canonicalwebteam.store_api.publishergw.PublisherGW"
170+ + ".get_remodel_allowlist"
171+ )
172+ def test_get_remodel_allowlist_success (self , mock_get_remodel_allowlist ):
173+ mock_allowlist = {
174+ "allowlist" : [
175+ {
176+ "created-at" : "2026-02-03T11:31:06Z" ,
177+ "created-by" : "test-user-id" ,
178+ "description" : "Test description" ,
179+ "from-model" : "test-from-model" ,
180+ "from-serial" : "test-from-serial" ,
181+ "modified-at" : None ,
182+ "modified-by" : None ,
183+ "to-model" : "test-to-model" ,
184+ }
185+ ]
186+ }
187+ mock_get_remodel_allowlist .return_value = mock_allowlist
188+
189+ response = self .client .get ("/api/store/1/models/remodel-allowlist" )
190+ data = response .json
191+
192+ self .assertEqual (response .status_code , 200 )
193+ self .assertTrue (data ["success" ])
194+ self .assertEqual (data ["data" ], mock_allowlist )
195+
196+ @patch (
197+ "canonicalwebteam.store_api.publishergw.PublisherGW"
198+ + ".get_remodel_allowlist"
199+ )
200+ def test_get_remodel_allowlist_empty (self , mock_get_remodel_allowlist ):
201+ mock_get_remodel_allowlist .return_value = {"allowlist" : []}
202+
203+ response = self .client .get ("/api/store/1/models/remodel-allowlist" )
204+ data = response .json
205+
206+ self .assertEqual (response .status_code , 200 )
207+ self .assertTrue (data ["success" ])
208+ self .assertEqual (data ["data" ]["allowlist" ], [])
209+
210+ @patch (
211+ "canonicalwebteam.store_api.publishergw.PublisherGW"
212+ + ".get_remodel_allowlist"
213+ )
214+ def test_get_remodel_allowlist_unauthorized (
215+ self , mock_get_remodel_allowlist
216+ ):
217+ mock_get_remodel_allowlist .side_effect = StoreApiResponseErrorList (
218+ "unauthorized" , 401 , [{"message" : "unauthorized" }]
219+ )
220+
221+ response = self .client .get ("/api/store/1/models/remodel-allowlist" )
222+ data = response .json
223+
224+ self .assertEqual (response .status_code , 500 )
225+ self .assertFalse (data ["success" ])
226+ self .assertEqual (data ["message" ], "Store not found" )
227+
228+ @patch (
229+ "canonicalwebteam.store_api.publishergw.PublisherGW"
230+ + ".get_remodel_allowlist"
231+ )
232+ def test_get_remodel_allowlist_store_not_found (
233+ self , mock_get_remodel_allowlist
234+ ):
235+ mock_get_remodel_allowlist .side_effect = StoreApiResponseErrorList (
236+ "Store not found" , 404 , [{"message" : "Store not found" }]
237+ )
238+
239+ response = self .client .get ("/api/store/999/models/remodel-allowlist" )
240+ data = response .json
241+
242+ self .assertEqual (response .status_code , 500 )
243+ self .assertFalse (data ["success" ])
244+ self .assertEqual (data ["message" ], "Store not found" )
245+
246+ @patch (
247+ "canonicalwebteam.store_api.publishergw.PublisherGW"
248+ + ".get_remodel_allowlist"
249+ )
250+ def test_get_remodel_allowlist_general_error (
251+ self , mock_get_remodel_allowlist
252+ ):
253+ mock_get_remodel_allowlist .side_effect = StoreApiResponseErrorList (
254+ "Internal server error" ,
255+ 500 ,
256+ [{"message" : "Internal server error" }],
257+ )
258+
259+ response = self .client .get ("/api/store/1/models/remodel-allowlist" )
260+ data = response .json
261+
262+ self .assertEqual (response .status_code , 500 )
263+ self .assertFalse (data ["success" ])
264+ self .assertEqual (data ["message" ], "Internal server error" )
0 commit comments