@@ -28,12 +28,12 @@ def setUpTestData(cls):
2828 super ().setUpTestData ()
2929 User .objects .create_user ("noperms" , "noperms@test.com" , "Test12345!" )
3030
31- def test_anonymous_cannot_unpublish (self ):
32- url = reverse ("unpublish_graph " , kwargs = {"graphid" : self .graphid })
33- with patch ("arches.app.views.graph.Graph.unpublish " ) as unpublish :
31+ def test_anonymous_cannot_publish (self ):
32+ url = reverse ("publish_graph " , kwargs = {"graphid" : self .graphid })
33+ with patch ("arches.app.views.graph.Graph.publish " ) as publish :
3434 response = Client ().post (url )
3535 self .assertIn (response .status_code , (302 , 401 , 403 ))
36- unpublish .assert_not_called ()
36+ publish .assert_not_called ()
3737
3838 def test_user_without_graph_editor_group_cannot_publish (self ):
3939 client = Client ()
@@ -44,14 +44,17 @@ def test_user_without_graph_editor_group_cannot_publish(self):
4444 self .assertIn (response .status_code , (302 , 401 , 403 ))
4545 publish .assert_not_called ()
4646
47- def test_graph_editor_can_unpublish (self ):
47+ def test_graph_editor_can_publish (self ):
4848 client = Client ()
4949 client .login (username = "admin" , password = "admin" )
50- url = reverse ("unpublish_graph" , kwargs = {"graphid" : self .graphid })
51- with patch ("arches.app.views.graph.Graph.unpublish" ) as unpublish :
50+ url = reverse ("publish_graph" , kwargs = {"graphid" : self .graphid })
51+ with (
52+ patch ("arches.app.views.graph.Graph.promote_draft_graph_to_active_graph" ),
53+ patch ("arches.app.views.graph.Graph.publish" ) as publish ,
54+ ):
5255 response = client .post (url , "{}" , content_type = "application/json" )
5356 self .assertEqual (response .status_code , 200 )
54- unpublish .assert_called_once ()
57+ publish .assert_called_once ()
5558
5659
5760class ConceptValueAuthorizationTests (ArchesTestCase ):
@@ -207,13 +210,13 @@ def setUp(self):
207210 self .unrelated_a = models .ResourceInstance .objects .create (graph_id = self .graphid )
208211 self .unrelated_b = models .ResourceInstance .objects .create (graph_id = self .graphid )
209212 self .rr = models .ResourceXResource .objects .create (
210- resourceinstanceidfrom = self .root ,
211- resourceinstanceidto = self .target ,
213+ from_resource = self .root ,
214+ to_resource = self .target ,
212215 relationshiptype = "http://www.w3.org/2004/02/skos/core#related" ,
213216 )
214217 self .foreign_rr = models .ResourceXResource .objects .create (
215- resourceinstanceidfrom = self .unrelated_a ,
216- resourceinstanceidto = self .unrelated_b ,
218+ from_resource = self .unrelated_a ,
219+ to_resource = self .unrelated_b ,
217220 relationshiptype = "http://www.w3.org/2004/02/skos/core#related" ,
218221 )
219222 self .client = Client ()
@@ -276,9 +279,7 @@ def test_create_without_edit_permission_is_denied(self):
276279 )
277280 self .assertEqual (response .status_code , 403 )
278281 self .assertEqual (
279- models .ResourceXResource .objects .filter (
280- resourceinstanceidfrom = self .root
281- ).count (),
282+ models .ResourceXResource .objects .filter (from_resource = self .root ).count (),
282283 1 ,
283284 )
284285
0 commit comments