Blame view

test/query_test.rb 1.44 KB
96149efa   Isaac Lewis   working query browse
1
2
3
  require "test_helper"
  
  class QueryTest < Minitest::Test
0f29247c   Isaac Lewis   add comfch and co...
4
    def test_query_browse
96149efa   Isaac Lewis   working query browse
5
6
7
8
9
10
11
12
13
14
15
16
17
      user_id = Syspro::Logon.logon("wland", "piperita2016", "L", "")
  
      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"}
      ]
  
0f29247c   Isaac Lewis   add comfch and co...
18
      browse_result = combrw.call(user_id.guid)
96149efa   Isaac Lewis   working query browse
19
  
0f29247c   Isaac Lewis   add comfch and co...
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
      refute_nil browse_result
    end
  
    def test_query_query
      user_id = Syspro::Logon.logon("wland", "piperita2016", "L", "")
  
      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"
  
724c1cbe   Isaac Lewis   add to readme; fi...
44
      query_result = comfnd.call(user_id.guid)
0f29247c   Isaac Lewis   add comfch and co...
45
  
724c1cbe   Isaac Lewis   add to readme; fi...
46
      refute_nil query_result
0f29247c   Isaac Lewis   add comfch and co...
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
    end
  
    def test_query_fetch
      user_id = Syspro::Logon.logon("wland", "piperita2016", "L", "")
  
      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
96149efa   Isaac Lewis   working query browse
63
64
    end
  end