@@ -64,6 +64,7 @@ class FakeBlock:
6464 }
6565
6666 with mock .patch ("lti_consumer.plugin.compat.load_enough_xblock" , return_value = fake_block ) as mock_load , \
67+ mock .patch ("lti_consumer.plugin.compat.save_xblock" ) as mock_save_xblock , \
6768 mock .patch ("lti_consumer.utils.model_to_dict" , return_value = values ):
6869 self .executor .loader .build_graph ()
6970 self .executor .migrate (self .migrate_to )
@@ -85,6 +86,7 @@ class FakeBlock:
8586
8687 mock_load .assert_called_once ()
8788 self .assertEqual (str (mock_load .call_args .args [0 ]), self .location )
89+ mock_save_xblock .assert_not_called ()
8890
8991 def test_migration_creates_passport_when_xblock_load_fails (self ):
9092 """Missing location skips XBlock path but still creates passport from DB."""
@@ -103,7 +105,7 @@ def test_migration_creates_passport_when_xblock_load_fails(self):
103105 with mock .patch (
104106 "lti_consumer.plugin.compat.load_enough_xblock" ,
105107 side_effect = Exception ("boom" ),
106- ) as mock_load , \
108+ ) as mock_load , mock . patch ( "lti_consumer.plugin.compat.save_xblock" ) as mock_save_xblock , \
107109 mock .patch ("lti_consumer.utils.model_to_dict" , return_value = values ), \
108110 mock .patch ("builtins.print" ) as mock_print :
109111 self .executor .loader .build_graph ()
@@ -125,6 +127,7 @@ def test_migration_creates_passport_when_xblock_load_fails(self):
125127 self .assertEqual (passport .lti_1p3_tool_keyset_url , "https://db.example/jwks.json" )
126128
127129 mock_load .assert_not_called ()
130+ mock_save_xblock .assert_not_called ()
128131 mock_print .assert_not_called ()
129132
130133 def test_migration_keeps_db_values_when_block_not_new (self ):
@@ -146,6 +149,7 @@ class FakeBlock:
146149 }
147150
148151 with mock .patch ("lti_consumer.plugin.compat.load_enough_xblock" , return_value = fake_block ) as mock_load , \
152+ mock .patch ("lti_consumer.plugin.compat.save_xblock" ) as mock_save_xblock , \
149153 mock .patch ("lti_consumer.utils.model_to_dict" , return_value = values ):
150154 self .executor .loader .build_graph ()
151155 self .executor .migrate (self .migrate_to )
@@ -162,6 +166,7 @@ class FakeBlock:
162166 self .assertEqual (passport .lti_1p3_tool_keyset_url , "https://db.example/jwks.json" )
163167
164168 self .assertEqual (str (mock_load .call_args .args [0 ]), self .location )
169+ mock_save_xblock .assert_not_called ()
165170
166171 def test_backwards_copies_passport_values_back_to_configuration (self ):
167172 """Reverse migration restores passport-backed values onto the configuration."""
0 commit comments