Exemplo n.º 1
0
 def test_copy_reset_translation_key_true_with_update_attrs_translation_key(
     self, mock_super
 ):
     page = make_test_page()
     update_attrs = {"translation_key": "123456"}
     page.copy(update_attrs=update_attrs)
     mock_super.assert_called_once()
     _, kwargs = mock_super.call_args_list[0]
     self.assertEqual(kwargs["update_attrs"]["translation_key"], "123456")
Exemplo n.º 2
0
 def test_copy_reset_translation_key_true_with_update_attrs_no_translation_key(
     self, mock_super, mock_uuid4
 ):
     mock_uuid4.return_value = "123456"
     page = make_test_page()
     page.copy(update_attrs={})
     mock_super.assert_called_once()
     _, kwargs = mock_super.call_args_list[0]
     self.assertEqual(kwargs["update_attrs"]["translation_key"], "123456")
Exemplo n.º 3
0
 def test_process_child_object_called(self):
     """
     Test that the `process_child_object` callable passed to `copy()` still gets
     called.
     """
     process_child_object = Mock()
     page = make_test_page()
     page.test_childobjects.add(TestChildObject(field="Test content"))
     page.save()
     update_attrs = {"slug": "new-slug"}
     page.copy(update_attrs=update_attrs, process_child_object=process_child_object)
     process_child_object.assert_called_once()
Exemplo n.º 4
0
 def test_copy_reset_translation_key_false(self, mock_super):
     page = make_test_page()
     # these would normally need to be changed to avoid integrity errors
     update_attrs = {"slug": "new-slug", "translation_key": "123456"}
     page.copy(reset_translation_key=False, update_attrs=update_attrs)
     mock_super.assert_called_once_with(update_attrs=update_attrs)