Blame view

test/invsws_test.rb 1.62 KB
762ae45f   chadzink   Added InvSws Busi...
1
2
3
4
  # frozen_string_literal: true
  
  require 'test_helper'
  
f4259c1e   Samuel J Clopton   fix tests and add...
5
  class InvSwsTest < Minitest::Test
762ae45f   chadzink   Added InvSws Busi...
6
7
    extend Minitest::Spec::DSL
  
f4259c1e   Samuel J Clopton   fix tests and add...
8
9
10
    before { VCR.insert_cassette name }
    after { VCR.eject_cassette }
  
762ae45f   chadzink   Added InvSws Busi...
11
12
13
14
15
16
17
18
    let(:username) { ENV['SYSPRO_USERNAME'] }
    let(:password) { ENV['SYSPRO_PASSWORD'] }
    let(:company) { ENV['SYSPRO_COMPANY'] }
    let(:company_password) { '' }
    let(:user_id) do
      Syspro::Logon.logon(username, password, company, company_password)
    end
  
f1e2e13b   chadzink   Implemented PorTo...
19
    def test_invsws
f4259c1e   Samuel J Clopton   fix tests and add...
20
      skip 'A new VCR cassette needs recorded for this test to pass'
762ae45f   chadzink   Added InvSws Busi...
21
      invsws_item = Syspro::BusinessObjects::Models::InvSwsItem.new
f4259c1e   Samuel J Clopton   fix tests and add...
22
      invsws_item.key_stock_code = "1004"
762ae45f   chadzink   Added InvSws Busi...
23
24
25
26
27
28
29
30
31
32
33
      invsws_item.key_warehouse = "P0"
      invsws_item.default_bin = "P0"
  
      invsws_req = Syspro::BusinessObjects::InvSws.new
      invsws_req.validate_only = "Y"
      invsws_req.apply_product_class_default = "BA"
      invsws_req.ignore_warnings = "N"
      invsws_req.apply_if_entire_document_valid = "Y"
      invsws_req.item = invsws_item
  
      invsws_resp = invsws_req.add(user_id.guid)
f4259c1e   Samuel J Clopton   fix tests and add...
34
  
762ae45f   chadzink   Added InvSws Busi...
35
36
      assert_equal invsws_resp[:error_numbers].length, 0
    end
f4259c1e   Samuel J Clopton   fix tests and add...
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
  
    def test_invsws_errors
      invsws_item = Syspro::BusinessObjects::Models::InvSwsItem.new
      invsws_item.key_stock_code = '1004'
      invsws_item.key_warehouse = 'P0'
      invsws_item.default_bin = 'P0'
  
      invsws_req = Syspro::BusinessObjects::InvSws.new
      invsws_req.validate_only = 'Y'
      invsws_req.apply_product_class_default = 'BA'
      invsws_req.ignore_warnings = 'N'
      invsws_req.apply_if_entire_document_valid = 'Y'
      invsws_req.item = invsws_item
  
      invsws_resp = invsws_req.add(user_id.guid)
  
      assert_equal invsws_resp[:errors].length, 1
    end
  end