@pytest.mark.django_db
def test_submit_no_source(rf, po_directory, default, store0):
 language = store0.translation_project.language
 unit = store0.units[0]
 source_string = unit.source_f
 directory = unit.store.parent
 post_dict = {'id': unit.id, 'index': unit.index, 'source_f_0': 'altered source string', 'target_f_0': 'dummy'}
 request = _create_post_request(rf, directory, data=post_dict, user=default)
 form = _create_unit_form(request, language, unit)
 assert form.is_valid()
 form.save()
 unit = store0.units[0]
 assert (unit.source_f == source_string)
 assert (unit.target_f == 'dummy')

@ pytest . mark . django_db def test_submit_no_source ( rf , po_directory , default , store0 ) : language = store0 . translation_project . language unit = store0 . units [ 0 ] source_string = unit . source_f directory = unit . store . parent post_dict = { 'id' : unit . id , 'index' : unit . index , 'source_f_0' : 'altered source string' , 'target_f_0' : 'dummy' } request = _create_post_request ( rf , directory , data = post_dict , user = default ) form = _create_unit_form ( request , language , unit ) assert form . is_valid ( ) form . save ( ) unit = store0 . units [ 0 ] assert ( unit . source_f == source_string ) assert ( unit . target_f == 'dummy' )
tests that the source string cannot be modified .