invsws_test.rb
1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# frozen_string_literal: true
require 'test_helper'
class InvSwsTest < Minitest::Test
extend Minitest::Spec::DSL
before { VCR.insert_cassette name }
after { VCR.eject_cassette }
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
def test_invsws
skip 'A new VCR cassette needs recorded for this test to pass'
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[:error_numbers].length, 0
end
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