query_test.rb
1.66 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# frozen_string_literal: true
require 'test_helper'
class QueryTest < Minitest::Test
extend Minitest::Spec::DSL
before { VCR.insert_cassette name }
after { VCR.eject_cassette }
let(:username) { 'wland' }
let(:password) { 'piperita2016' }
let(:company) { 'L' }
let(:company_password) { '' }
let(:user_id) do
Syspro::Logon.logon(username, password, company, company_password)
end
def test_query_browse # rubocop:disable Metrics/MethodLength
combrw = Syspro::BusinessObjects::ComBrw.new
combrw.browse_name = 'InvMaster'
combrw.start_condition = ''
combrw.return_rows = 5
combrw.filters = []
combrw.table_name = 'InvMaster'
combrw.title = 'StockCodes'
combrw.columns = [
{ name: 'StockCode' }
]
browse_result = combrw.call(user_id.guid)
refute_nil browse_result
end
def test_query_query # rubocop:disable Metrics/MethodLength
comfnd = Syspro::BusinessObjects::ComFnd.new
comfnd.table_name = 'InvMaster'
comfnd.return_rows = 5
comfnd.columns = [
{
name: 'StockCode'
}
]
comfnd.expressions = [
{
andor: 'And',
column: 'StockCode',
condition: 'EQ',
value: '02'
}
]
comfnd.order_by = 'StockCode'
query_result = comfnd.call(user_id.guid)
refute_nil query_result
end
def test_query_fetch
comfch = Syspro::BusinessObjects::ComFch.new
comfch.table_name = 'InvMaster'
comfch.key = '02'
comfch.optional_keys = []
comfch.full_key_provided = false
comfch.default_type = ''
comfch.espresso_fetch = true
fetch_result = comfch.call(user_id.guid)
refute_nil fetch_result
end
end