diff --git a/test/integration/eis_billing/e_invoice_response_test.rb b/test/integration/eis_billing/e_invoice_response_test.rb new file mode 100644 index 000000000..c282962c5 --- /dev/null +++ b/test/integration/eis_billing/e_invoice_response_test.rb @@ -0,0 +1,17 @@ +require 'test_helper' + +class EInvoiceResponseTest < ApplicationIntegrationTest + setup do + sign_in users(:api_bestnames) + @invoice = invoices(:one) + Spy.on_instance_method(EisBilling::BaseController, :authorized).and_return(true) + end + + def test_invoice_should_be_mark_as_sent + assert_nil @invoice.e_invoice_sent_at + put eis_billing_e_invoice_response_path, params: { invoice_number: @invoice.number} + + @invoice.reload + assert_not_nil @invoice.e_invoice_sent_at + end +end diff --git a/test/services/send_data_to_directo_test.rb b/test/services/send_data_to_directo_test.rb new file mode 100644 index 000000000..fde9d35d3 --- /dev/null +++ b/test/services/send_data_to_directo_test.rb @@ -0,0 +1,15 @@ +require 'test_helper' + +class SendDataToDirectoTest < ActiveSupport::TestCase + setup do + Spy.on_instance_method(EisBilling::BaseController, :authorized).and_return(true) + end + + def test_should_send_data_to_billing_directo + stub_request(:post, "http://eis_billing_system:3000/api/v1/directo/directo"). + to_return(status: 200, body: "ok", headers: {}) + + res = EisBilling::SendDataToDirecto.send_request(object_data: [], monthly: true, dry: true) + assert_equal res.body, "ok" + end +end