updated tests

This commit is contained in:
olegphenomenon 2022-02-10 15:03:27 +02:00
parent ef03166fee
commit d0236be063
21 changed files with 578 additions and 658 deletions

View file

@ -6,35 +6,40 @@ class DirectoResponseTest < ApplicationIntegrationTest
@invoice = invoices(:one)
@response_xml = '<?xml version="1.0" encoding="UTF-8"?><results><Result Type="0" Desc="OK" docid="1" doctype="ARVE" submit="Invoices"/></results>'
Spy.on_instance_method(EisBilling::BaseController, :authorized).and_return(true)
end
def test_should_created_directo_instance
directo_response_from_billing = {
response: 'this is response',
xml_data: @response_xml,
month: true
}
if Feature.billing_system_integrated?
directo_response_from_billing = {
response: 'this is response',
xml_data: @response_xml,
month: true
}
assert_difference 'Directo.count', 1 do
put eis_billing_directo_response_path, params: JSON.parse(directo_response_from_billing.to_json),
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
assert_difference 'Directo.count', 1 do
put eis_billing_directo_response_path, params: JSON.parse(directo_response_from_billing.to_json),
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
end
end
def test_should_update_related_invoice
directo_response_from_billing = {
response: 'this is response',
xml_data: @response_xml
}
if Feature.billing_system_integrated?
directo_response_from_billing = {
response: 'this is response',
xml_data: @response_xml
}
refute @invoice.in_directo
refute @invoice.in_directo
assert_difference 'Directo.count', 1 do
put eis_billing_directo_response_path, params: JSON.parse(directo_response_from_billing.to_json),
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
assert_difference 'Directo.count', 1 do
put eis_billing_directo_response_path, params: JSON.parse(directo_response_from_billing.to_json),
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
@invoice.reload
assert @invoice.in_directo
end
@invoice.reload
assert @invoice.in_directo
end
end