tsubaiso-sdk 1.2.6 → 1.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +3 -2
- data/lib/tsubaiso_sdk.rb +550 -118
- data/test/stubbings/stub_register.rb +196 -0
- data/test/tsubaiso_sdk/common_setup_and_teardown.rb +23 -0
- data/test/tsubaiso_sdk/test_ap_reason_masters.rb +26 -0
- data/test/tsubaiso_sdk/test_api_history.rb +27 -0
- data/test/tsubaiso_sdk/test_ar_reason_masters.rb +26 -0
- data/test/tsubaiso_sdk/test_bank_account.rb +34 -0
- data/test/tsubaiso_sdk/test_bank_account_master.rb +119 -0
- data/test/tsubaiso_sdk/test_bank_account_transaction.rb +61 -0
- data/test/tsubaiso_sdk/test_bank_reason_master.rb +90 -0
- data/test/tsubaiso_sdk/test_bonus.rb +26 -0
- data/test/tsubaiso_sdk/test_bulk_scheduled_dates.rb +24 -0
- data/test/tsubaiso_sdk/test_corporate_master.rb +27 -0
- data/test/tsubaiso_sdk/test_customer.rb +71 -0
- data/test/tsubaiso_sdk/test_dept.rb +66 -0
- data/test/tsubaiso_sdk/test_fixed_assets.rb +18 -0
- data/test/tsubaiso_sdk/test_journal.rb +53 -0
- data/test/tsubaiso_sdk/test_journal_distribution.rb +29 -0
- data/test/tsubaiso_sdk/test_manual_journal.rb +84 -0
- data/test/tsubaiso_sdk/test_payrolles.rb +26 -0
- data/test/tsubaiso_sdk/test_petty_cash_reason_master.rb +72 -0
- data/test/tsubaiso_sdk/test_physical_inventory_master.rb +84 -0
- data/test/tsubaiso_sdk/test_purchase.rb +120 -0
- data/test/tsubaiso_sdk/test_reimbursement_reason_master.rb +27 -0
- data/test/tsubaiso_sdk/test_reimbursements.rb +63 -0
- data/test/tsubaiso_sdk/test_reimbursements_transactions.rb +75 -0
- data/test/tsubaiso_sdk/test_sale.rb +125 -0
- data/test/tsubaiso_sdk/test_scheduled_dates.rb +16 -0
- data/test/tsubaiso_sdk/test_staff.rb +26 -0
- data/test/tsubaiso_sdk/test_staff_data.rb +71 -0
- data/test/tsubaiso_sdk/test_staff_datum_master.rb +37 -0
- data/test/tsubaiso_sdk/test_tag.rb +53 -0
- data/test/tsubaiso_sdk/test_tax_master.rb +25 -0
- metadata +35 -5
- data/test/test_tsubaiso_sdk.rb +0 -964
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
require 'minitest/autorun'
|
|
2
|
+
require_relative './common_setup_and_teardown.rb'
|
|
3
|
+
|
|
4
|
+
class BankAccountTransactionTest < Minitest::Test
|
|
5
|
+
include CommonSetupAndTeardown
|
|
6
|
+
|
|
7
|
+
def setup
|
|
8
|
+
@bank_account_transaction_1 = {
|
|
9
|
+
bank_account_id: 0,
|
|
10
|
+
journal_timestamp: "2019-07-25",
|
|
11
|
+
price_value: 1000,
|
|
12
|
+
reason_code: "xxxx_123",
|
|
13
|
+
dc: "d",
|
|
14
|
+
brief: "this is sample transactions",
|
|
15
|
+
memo: "this is created from API.",
|
|
16
|
+
dept_code: "HEAD"
|
|
17
|
+
}
|
|
18
|
+
super("bank_account_transactions")
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def test_create_bank_account_transaction
|
|
22
|
+
created_bat = @api.create_bank_account_transaction(@bank_account_transaction_1)
|
|
23
|
+
assert_equal 200, created_bat[:status].to_i, created_bat.inspect
|
|
24
|
+
|
|
25
|
+
shown_bat = @api.show_bank_account_transaction(created_bat[:json][:id])
|
|
26
|
+
assert_equal 200, shown_bat[:status].to_i, shown_bat.inspect
|
|
27
|
+
assert_equal created_bat[:json][:id], shown_bat[:json][:id]
|
|
28
|
+
|
|
29
|
+
listed_bats = @api.list_bank_account_transactions(@bank_account_transaction_1[:bank_account_id])
|
|
30
|
+
target_bat = listed_bats[:json].find{ |bat| bat[:id] == created_bat[:json][:id]}
|
|
31
|
+
|
|
32
|
+
assert target_bat != nil
|
|
33
|
+
assert_equal Time.parse(@bank_account_transaction_1[:journal_timestamp]), Time.parse(target_bat[:journal_timestamp])
|
|
34
|
+
assert_equal @bank_account_transaction_1[:price_value], target_bat[:price_value]
|
|
35
|
+
assert_equal @bank_account_transaction_1[:memo], target_bat[:memo]
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def test_update_bank_account_transaction
|
|
39
|
+
created_bank_account_transaction = @api.create_bank_account_transaction(@bank_account_transaction_1)
|
|
40
|
+
assert_equal 200, created_bank_account_transaction[:status].to_i, created_bank_account_transaction.inspect
|
|
41
|
+
|
|
42
|
+
update_options = {
|
|
43
|
+
price_value: 500,
|
|
44
|
+
reason_code: "TEST_CASH_HATAGAYA",
|
|
45
|
+
brief: "this is sample updated transactions",
|
|
46
|
+
dc: 'd'
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
update_options[:id] = created_bank_account_transaction[:json][:id]
|
|
50
|
+
updated_bat = @api.update_bank_account_transaction(update_options)[:json]
|
|
51
|
+
assert_equal 200, @api.update_bank_account_transaction(update_options)[:status].to_i
|
|
52
|
+
|
|
53
|
+
assert_equal update_options[:price_value], updated_bat[:price_value]
|
|
54
|
+
assert_equal update_options[:reason_code], updated_bat[:reason_code]
|
|
55
|
+
assert_equal update_options[:brief], updated_bat[:brief]
|
|
56
|
+
assert_equal update_options[:dc], updated_bat[:dc]
|
|
57
|
+
|
|
58
|
+
assert_equal Time.parse(@bank_account_transaction_1[:journal_timestamp]), Time.parse(updated_bat[:journal_timestamp])
|
|
59
|
+
assert_equal @bank_account_transaction_1[:memo], updated_bat[:memo]
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
require 'minitest/autorun'
|
|
2
|
+
require_relative './common_setup_and_teardown.rb'
|
|
3
|
+
|
|
4
|
+
class BankReasonMasterTest < Minitest::Test
|
|
5
|
+
include CommonSetupAndTeardown
|
|
6
|
+
|
|
7
|
+
def setup
|
|
8
|
+
@bank_reason_master_1 = {
|
|
9
|
+
sort_number: 1,
|
|
10
|
+
reason_code: "create_from_API",
|
|
11
|
+
reason_name: "New Bank Reason Created From API",
|
|
12
|
+
dc: "d",
|
|
13
|
+
is_valid: 0,
|
|
14
|
+
memo: "This reason has been created form API",
|
|
15
|
+
account_code: 1
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@bank_reason_master_2 = {
|
|
19
|
+
sort_number: 1,
|
|
20
|
+
reason_code: "create_from_API2",
|
|
21
|
+
reason_name: "New Bank Reason Created From API2",
|
|
22
|
+
dc: "c",
|
|
23
|
+
is_valid: 0,
|
|
24
|
+
memo: "This reason has been created form API2",
|
|
25
|
+
account_code: 1
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@bank_reason_master_3 = {
|
|
29
|
+
sort_number: 1,
|
|
30
|
+
reason_code: "create_from_API3",
|
|
31
|
+
reason_name: "New Bank Reason Created From API3",
|
|
32
|
+
dc: "d",
|
|
33
|
+
is_valid: 0,
|
|
34
|
+
memo: "This reason has been created form API3",
|
|
35
|
+
account_code: 1
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
super("bank_reason_masters")
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def test_list_bank_reason_masters
|
|
42
|
+
created_bank_reason_master_1 = @api.create_bank_reason_masters(@bank_reason_master_1)
|
|
43
|
+
created_bank_reason_master_2 = @api.create_bank_reason_masters(@bank_reason_master_2)
|
|
44
|
+
created_bank_reason_master_3 = @api.create_bank_reason_masters(@bank_reason_master_3)
|
|
45
|
+
|
|
46
|
+
assert_equal 200, created_bank_reason_master_1[:status].to_i
|
|
47
|
+
assert_equal 200, created_bank_reason_master_2[:status].to_i
|
|
48
|
+
assert_equal 200, created_bank_reason_master_3[:status].to_i
|
|
49
|
+
|
|
50
|
+
created_master_id_1 = created_bank_reason_master_1[:json][:id]
|
|
51
|
+
created_master_id_2 = created_bank_reason_master_2[:json][:id]
|
|
52
|
+
created_master_id_3 = created_bank_reason_master_3[:json][:id]
|
|
53
|
+
|
|
54
|
+
bank_reason_master_list = @api.list_bank_reason_masters
|
|
55
|
+
assert_equal 200, bank_reason_master_list[:status].to_i, bank_reason_master_list.inspect
|
|
56
|
+
assert(bank_reason_master_list[:json].any? { |x| x[:id] == created_master_id_1 })
|
|
57
|
+
assert(bank_reason_master_list[:json].any? { |x| x[:id] == created_master_id_2 })
|
|
58
|
+
assert(bank_reason_master_list[:json].any? { |x| x[:id] == created_master_id_3 })
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def test_show_bank_reason_master
|
|
62
|
+
created_bank_reason_master = @api.create_bank_reason_masters(@bank_reason_master_1)
|
|
63
|
+
shown_bank_reason_master = @api.show_bank_reason_master(created_bank_reason_master[:json][:id])
|
|
64
|
+
assert_equal @bank_reason_master_1[:sort_number], shown_bank_reason_master[:json][:sort_number]
|
|
65
|
+
assert_equal @bank_reason_master_1[:reason_code], shown_bank_reason_master[:json][:reason_code]
|
|
66
|
+
assert_equal @bank_reason_master_1[:reason_name], shown_bank_reason_master[:json][:reason_name]
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def test_update_bank_reason_masters
|
|
70
|
+
created_bank_reason_master = @api.create_bank_reason_masters(@bank_reason_master_1)
|
|
71
|
+
assert_equal 200, created_bank_reason_master[:status].to_i
|
|
72
|
+
|
|
73
|
+
updating_options = {
|
|
74
|
+
id: created_bank_reason_master[:json][:id].to_i,
|
|
75
|
+
sort_number: 2,
|
|
76
|
+
reason_name: "updated reason name",
|
|
77
|
+
memo: "This reason has been updated from API."
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
updated_bank_reason_master = @api.update_bank_reason_masters(updating_options)
|
|
81
|
+
assert_equal 200, updated_bank_reason_master[:status].to_i
|
|
82
|
+
assert_equal updating_options[:sort_number], updated_bank_reason_master[:json][:sort_number]
|
|
83
|
+
assert_equal updating_options[:reason_name], updated_bank_reason_master[:json][:reason_name]
|
|
84
|
+
assert_equal updating_options[:memo], updated_bank_reason_master[:json][:memo]
|
|
85
|
+
|
|
86
|
+
assert_equal @bank_reason_master_1[:reason_code], updated_bank_reason_master[:json][:reason_code]
|
|
87
|
+
assert_equal @bank_reason_master_1[:dc], updated_bank_reason_master[:json][:dc]
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
require 'minitest/autorun'
|
|
2
|
+
require_relative './common_setup_and_teardown.rb'
|
|
3
|
+
|
|
4
|
+
class BonusTest < Minitest::Test
|
|
5
|
+
include CommonSetupAndTeardown
|
|
6
|
+
|
|
7
|
+
def setup
|
|
8
|
+
super("bonuses")
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def test_list_bonuses
|
|
12
|
+
bonuses_list = @api.list_bonuses(1, 2016)
|
|
13
|
+
assert_equal 200, bonuses_list[:status].to_i, bonuses_list.inspect
|
|
14
|
+
assert bonuses_list[:json]
|
|
15
|
+
assert !bonuses_list[:json].empty?
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def test_show_bonus
|
|
19
|
+
bonuses = @api.list_bonuses(1, 2016)
|
|
20
|
+
bonus_id = bonuses[:json].first[:id]
|
|
21
|
+
bonus = @api.show_bonus(bonus_id)
|
|
22
|
+
|
|
23
|
+
assert_equal 200, bonus[:status].to_i, bonus.inspect
|
|
24
|
+
assert_equal bonus[:json][:id], bonus_id
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require 'minitest/autorun'
|
|
2
|
+
require_relative './common_setup_and_teardown.rb'
|
|
3
|
+
|
|
4
|
+
class BulkScheduledDatesTest < Minitest::Test
|
|
5
|
+
include CommonSetupAndTeardown
|
|
6
|
+
|
|
7
|
+
def setup
|
|
8
|
+
super('scheduled_dates')
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def test_calc_scheduled_dates
|
|
12
|
+
input_scheduled_dates = [
|
|
13
|
+
{ target_date: '2019-01-02', sight: '1m10', closing_day: '5', shift: 'before' },
|
|
14
|
+
{ target_date: nil, sight: '1m10', closing_day: '5', shift: 'before' }
|
|
15
|
+
]
|
|
16
|
+
response = @api.bulk_scheduled_date(input_scheduled_dates)
|
|
17
|
+
assert_equal '200', response[:status]
|
|
18
|
+
assert_equal '2019-01-10', response[:json][0][:scheduled_date]
|
|
19
|
+
assert_equal '200', response[:json][0][:status]
|
|
20
|
+
|
|
21
|
+
assert_equal '422', response[:json][1][:status]
|
|
22
|
+
assert_equal 'target date is required', respoonse[:json][1][:error]
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
require 'minitest/autorun'
|
|
2
|
+
require_relative './common_setup_and_teardown.rb'
|
|
3
|
+
|
|
4
|
+
class CorporateMasterTest < Minitest::Test
|
|
5
|
+
include CommonSetupAndTeardown
|
|
6
|
+
|
|
7
|
+
def setup
|
|
8
|
+
super('corporate_masters')
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def test_show_corporate_master
|
|
12
|
+
# With HatagayaTest CorporateMaster ID Only
|
|
13
|
+
shown_corporate_master = @api.show_corporate_master(0)
|
|
14
|
+
assert_equal 3, shown_corporate_master[:json][:corporate_code]
|
|
15
|
+
assert_equal '幡ヶ谷建設株式会社', shown_corporate_master[:json][:name]
|
|
16
|
+
|
|
17
|
+
# With HatagayaTest Corporate Code Only
|
|
18
|
+
shown_corporate_master = @api.show_corporate_master(nil, { ccode: 3 })
|
|
19
|
+
assert_equal 3, shown_corporate_master[:json][:corporate_code]
|
|
20
|
+
assert_equal '幡ヶ谷建設株式会社', shown_corporate_master[:json][:name]
|
|
21
|
+
|
|
22
|
+
# With HatagayaTest Both CorporateMaster ID and Corporate Code
|
|
23
|
+
shown_corporate_master = @api.show_corporate_master(0, { ccode: 3 })
|
|
24
|
+
assert_equal 3, shown_corporate_master[:json][:corporate_code]
|
|
25
|
+
assert_equal '幡ヶ谷建設株式会社', shown_corporate_master[:json][:name]
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
require 'minitest/autorun'
|
|
2
|
+
require_relative './common_setup_and_teardown.rb'
|
|
3
|
+
|
|
4
|
+
class CustomerTest < Minitest::Test
|
|
5
|
+
include CommonSetupAndTeardown
|
|
6
|
+
|
|
7
|
+
def setup
|
|
8
|
+
@customer_1000 = {
|
|
9
|
+
name: 'テスト株式会社',
|
|
10
|
+
name_kana: 'テストカブシキガイシャ',
|
|
11
|
+
code: '10000',
|
|
12
|
+
tax_type_for_remittance_charge: '3',
|
|
13
|
+
used_in_ar: 1,
|
|
14
|
+
used_in_ap: 1,
|
|
15
|
+
is_valid: 1,
|
|
16
|
+
pay_date_if_holiday: 1,
|
|
17
|
+
receive_date_if_holiday: 1
|
|
18
|
+
}
|
|
19
|
+
super("customer_masters")
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def test_create_customer
|
|
23
|
+
customer = @api.create_customer(@customer_1000)
|
|
24
|
+
|
|
25
|
+
assert_equal 200, customer[:status].to_i, customer.inspect
|
|
26
|
+
assert_equal @customer_1000[:name], customer[:json][:name]
|
|
27
|
+
assert_equal @customer_1000[:pay_date_if_holiday], customer[:json][:pay_date_if_holiday]
|
|
28
|
+
assert_equal @customer_1000[:receive_date_if_holiday], customer[:json][:receive_date_if_holiday]
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def test_update_customer
|
|
32
|
+
customer = @api.create_customer(@customer_1000)
|
|
33
|
+
options = {
|
|
34
|
+
id: customer[:json][:id],
|
|
35
|
+
name: 'New Customer Name',
|
|
36
|
+
pay_date_if_holiday: 0,
|
|
37
|
+
receive_date_if_holiday: 0
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
updated_customer = @api.update_customer(options)
|
|
41
|
+
assert_equal 200, updated_customer[:status].to_i
|
|
42
|
+
assert_equal customer[:json][:id], updated_customer[:json][:id]
|
|
43
|
+
assert_equal options[:name], updated_customer[:json][:name]
|
|
44
|
+
assert_equal options[:pay_date_if_holiday], updated_customer[:json][:pay_date_if_holiday]
|
|
45
|
+
assert_equal options[:receive_date_if_holiday], updated_customer[:json][:receive_date_if_holiday]
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def test_show_customer
|
|
49
|
+
customer = @api.create_customer(@customer_1000)
|
|
50
|
+
get_customer = @api.show_customer(customer[:json][:id])
|
|
51
|
+
assert_equal 200, get_customer[:status].to_i, get_customer.inspect
|
|
52
|
+
assert_equal customer[:json][:id], get_customer[:json][:id]
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def test_show_customer_by_code
|
|
56
|
+
customer = @api.create_customer(@customer_1000)
|
|
57
|
+
|
|
58
|
+
get_customer = @api.show_customer_by_code(@customer_1000[:code])
|
|
59
|
+
assert_equal 200, get_customer[:status].to_i, get_customer.inspect
|
|
60
|
+
assert_equal customer[:json][:id], get_customer[:json][:id]
|
|
61
|
+
assert_equal customer[:json][:code], get_customer[:json][:code]
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def test_list_customers
|
|
65
|
+
customer_1000 = @api.create_customer(@customer_1000)
|
|
66
|
+
customer_1000_id = customer_1000[:json][:id]
|
|
67
|
+
customer_list = @api.list_customers
|
|
68
|
+
assert_equal 200, customer_list[:status].to_i, customer_list.inspect
|
|
69
|
+
assert(customer_list[:json].any? { |x| x[:id] == customer_1000_id })
|
|
70
|
+
end
|
|
71
|
+
end
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
require 'minitest/autorun'
|
|
2
|
+
require_relative './common_setup_and_teardown.rb'
|
|
3
|
+
|
|
4
|
+
class DeptsTest < Minitest::Test
|
|
5
|
+
include CommonSetupAndTeardown
|
|
6
|
+
|
|
7
|
+
def setup
|
|
8
|
+
@dept_1 = {
|
|
9
|
+
sort_no: 12_345_678,
|
|
10
|
+
code: 'test_code',
|
|
11
|
+
name: 'テスト部門',
|
|
12
|
+
name_abbr: 'テストブモン',
|
|
13
|
+
color: '#ffffff',
|
|
14
|
+
memo: 'テストメモ',
|
|
15
|
+
start_date: '2016-01-01',
|
|
16
|
+
finish_date: '2016-01-02'
|
|
17
|
+
}
|
|
18
|
+
super("depts")
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def test_create_dept
|
|
22
|
+
dept = @api.create_dept(@dept_1)
|
|
23
|
+
assert_equal 200, dept[:status].to_i, dept.inspect
|
|
24
|
+
assert_equal @dept_1[:code], dept[:json][:code]
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def test_update_dept
|
|
28
|
+
dept = @api.create_dept(@dept_1)
|
|
29
|
+
options = {
|
|
30
|
+
id: dept[:json][:id],
|
|
31
|
+
sort_no: 98_765,
|
|
32
|
+
memo: 'updated at test',
|
|
33
|
+
name: '更新部門',
|
|
34
|
+
name_abbr: '更新部門'
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
updated_dept = @api.update_dept(dept[:json][:id], options)
|
|
38
|
+
assert_equal 200, updated_dept[:status].to_i, updated_dept.inspect
|
|
39
|
+
assert_equal options[:memo], updated_dept[:json][:memo]
|
|
40
|
+
assert_equal options[:name], updated_dept[:json][:name]
|
|
41
|
+
assert_equal options[:name_abbr], updated_dept[:json][:name_abbr]
|
|
42
|
+
ensure
|
|
43
|
+
@api.destroy_dept(updated_dept[:json][:id] || dept[:json][:id]) if updated_dept[:json][:id] || dept[:json][:id]
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def test_show_dept
|
|
47
|
+
dept = @api.create_dept(@dept_1)
|
|
48
|
+
dept = @api.show_dept(dept[:json][:id])
|
|
49
|
+
|
|
50
|
+
assert_equal 200, dept[:status].to_i, dept.inspect
|
|
51
|
+
assert_equal @dept_1[:memo], dept[:json][:memo]
|
|
52
|
+
@api.destroy_dept(dept[:json][:id])
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def test_list_depts
|
|
56
|
+
dept = @api.create_dept(@dept_1)
|
|
57
|
+
assert_equal 200, dept[:status].to_i, dept.inspect
|
|
58
|
+
|
|
59
|
+
depts = @api.list_depts
|
|
60
|
+
assert_equal 200, depts[:status].to_i, depts.inspect
|
|
61
|
+
assert(depts[:json].any? { |x| x[:id] == dept[:json][:id] })
|
|
62
|
+
ensure
|
|
63
|
+
@api.destroy_dept(dept[:json][:id]) if dept[:json][:id]
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require 'minitest/autorun'
|
|
2
|
+
require_relative './common_setup_and_teardown.rb'
|
|
3
|
+
|
|
4
|
+
class FixedAssetsTest < Minitest::Test
|
|
5
|
+
include CommonSetupAndTeardown
|
|
6
|
+
|
|
7
|
+
def setup
|
|
8
|
+
super('fixed_assets')
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def test_list_fixed_assets
|
|
12
|
+
list = @api.list_fixed_assets
|
|
13
|
+
assert_equal 200, list[:status].to_i, list.inspect
|
|
14
|
+
assert list[:json]
|
|
15
|
+
assert !list[:json].empty?
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
require 'minitest/autorun'
|
|
2
|
+
require_relative './common_setup_and_teardown.rb'
|
|
3
|
+
|
|
4
|
+
class JournalsTest < Minitest::Test
|
|
5
|
+
include CommonSetupAndTeardown
|
|
6
|
+
|
|
7
|
+
def setup
|
|
8
|
+
super('journals')
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def test_list_journals
|
|
12
|
+
options = { start_date: '2019-12-01', finish_date: '2019-12-31' }
|
|
13
|
+
journals_list = @api.list_journals(options)
|
|
14
|
+
records = journals_list[:json][:records]
|
|
15
|
+
assert_equal 200, journals_list[:status].to_i, journals_list.inspect
|
|
16
|
+
assert_equal records.size, 3
|
|
17
|
+
|
|
18
|
+
options = { price_min: 10_800, price_max: 10_800 }
|
|
19
|
+
journals_list = @api.list_journals(options)
|
|
20
|
+
records = journals_list[:json][:records]
|
|
21
|
+
assert_equal 200, journals_list[:status].to_i, journals_list.inspect
|
|
22
|
+
assert_equal records.size, 3
|
|
23
|
+
record_prices = records.map { |x| x[:journal_dcs].map { |y| y[:debit][:price_excluding_tax] } }.flatten(1)
|
|
24
|
+
record_prices.each do |price|
|
|
25
|
+
assert_equal price, 10_800
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
options = { dept_code: 'SETSURITSU' }
|
|
29
|
+
journals_list = @api.list_journals(options)
|
|
30
|
+
records = journals_list[:json][:records]
|
|
31
|
+
assert_equal 200, journals_list[:status].to_i, journals_list.inspect
|
|
32
|
+
assert_equal records.size, 3
|
|
33
|
+
record_depts = records.map { |x| x[:journal_dcs].map { |y| y[:dept_code] } }.flatten(1)
|
|
34
|
+
record_depts.each do |dept|
|
|
35
|
+
assert_equal dept, "SETSURITSU"
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def test_show_journal
|
|
41
|
+
journal0 = @api.show_journal(0)
|
|
42
|
+
journal1 = @api.show_journal(1)
|
|
43
|
+
journal2 = @api.show_journal(2)
|
|
44
|
+
|
|
45
|
+
assert_equal 200, journal0[:status].to_i, journal0.inspect
|
|
46
|
+
assert_equal 200, journal0[:status].to_i, journal1.inspect
|
|
47
|
+
assert_equal 200, journal0[:status].to_i, journal2.inspect
|
|
48
|
+
|
|
49
|
+
assert_equal 0.to_s, journal0[:json][:record][:id]
|
|
50
|
+
assert_equal 1.to_s, journal1[:json][:record][:id]
|
|
51
|
+
assert_equal 2.to_s, journal2[:json][:record][:id]
|
|
52
|
+
end
|
|
53
|
+
end
|