REPP:: Contact create/update legaldoc test

This commit is contained in:
Karl Erik Õunapuu 2020-10-20 15:36:40 +03:00
parent 33f6da53c1
commit ddc26b81b1
No known key found for this signature in database
GPG key ID: C9DD647298A34764
3 changed files with 52 additions and 6 deletions

View file

@ -79,4 +79,26 @@ class ReppV1ContactsUpdateTest < ActionDispatch::IntegrationTest
assert_equal 2308, json[:code]
assert json[:message].include? 'Ident update is not allowed. Consider creating new contact object'
end
def test_attaches_legaldoc_if_present
request_body = {
"contact": {
"email": "donaldtrump@yandex.ru"
},
"legal_document": {
"type": "pdf",
"body": "#{'test' * 2000}"
}
}
put "/repp/v1/contacts/#{@contact.code}", headers: @auth_headers, params: request_body
json = JSON.parse(response.body, symbolize_names: true)
assert_response :ok
assert_equal 1000, json[:code]
assert_equal 'Command completed successfully', json[:message]
@contact.reload
assert @contact.legal_documents.any?
end
end