@pytest.mark.django_db
def test_submit_unit_plural(client, unit_plural, request_users, settings):
 settings.POOTLE_CAPTCHA_ENABLED = False
 user = request_users['user']
 if (user.username != 'nobody'):
  client.login(username=user.username, password=request_users['password'])
 url = ('/xhr/units/%d/' % unit_plural.id)
 target = [('%s' % unit_plural.target.strings[0]), ('%s changed' % unit_plural.target.strings[1])]
 response = client.post(url, {'target_f_0': target[0], 'target_f_1': target[1]}, HTTP_X_REQUESTED_WITH='XMLHttpRequest')
 if check_permission('translate', response.wsgi_request):
  assert (response.status_code == 200)
  changed = Unit.objects.get(id=unit_plural.id)
  assert (changed.target == multistring(target))
 else:
  assert (response.status_code == 403)

@ pytest . mark . django_db def test_submit_unit_plural ( client , unit_plural , request_users , settings ) : settings . POOTLE_CAPTCHA_ENABLED = False user = request_users [ 'user' ] if ( user . username != 'nobody' ) : client . login ( username = user . username , password = request_users [ 'password' ] ) url = ( '/xhr/units/%d/' % unit_plural . id ) target = [ ( '%s' % unit_plural . target . strings [ 0 ] ) , ( '%s changed' % unit_plural . target . strings [ 1 ] ) ] response = client . post ( url , { 'target_f_0' : target [ 0 ] , 'target_f_1' : target [ 1 ] } , HTTP_X_REQUESTED_WITH = 'XMLHttpRequest' ) if check_permission ( 'translate' , response . wsgi_request ) : assert ( response . status_code == 200 ) changed = Unit . objects . get ( id = unit_plural . id ) assert ( changed . target == multistring ( target ) ) else : assert ( response . status_code == 403 )
tests translation can be applied after suggestion is accepted .