1+ require_relative './MerchantConfigData.rb'
2+ require_relative './spec_helper'
3+
4+ describe Merchantconfig do
5+ it 'Validating enablelog as null MerchantConfig File' do
6+ cybsPropertyobj = MerchantConfigData . new . merchantConfigProp
7+ cybsPropertyobj [ 'enableLog' ] = ''
8+ merchantConfigObj = Merchantconfig . new cybsPropertyobj
9+ expect ( merchantConfigObj . enableLog ) . to eq true
10+ end
11+ it 'Validating logFileName as null MerchantConfig File' do
12+ cybsPropertyobj = MerchantConfigData . new . merchantConfigProp
13+ cybsPropertyobj [ 'logFilename' ] = ''
14+ merchantConfigObj = Merchantconfig . new cybsPropertyobj
15+ expect ( merchantConfigObj . logFilename ) . to eq 'cybs'
16+ end
17+ it 'Validating enableLog as fixnum in MerchantConfig File' do
18+ cybsPropertyobj = MerchantConfigData . new . merchantConfigProp
19+ cybsPropertyobj [ 'enableLog' ] = 123
20+ merchantConfigObj = Merchantconfig . new cybsPropertyobj
21+ expect ( merchantConfigObj . enableLog ) . to eq '123'
22+ end
23+ it 'Validating logDirectory as fixnum in MerchantConfig File' do
24+ cybsPropertyobj = MerchantConfigData . new . merchantConfigProp
25+ cybsPropertyobj [ 'logDirectory' ] = ''
26+ merchantConfigObj = Merchantconfig . new cybsPropertyobj
27+ expect ( merchantConfigObj . logDirectory ) . to eq '../log'
28+ end
29+ it 'Validating RunEnvironment as Prod MerchantConfig File' do
30+ cybsPropertyobj = MerchantConfigData . new . merchantConfigProp
31+ cybsPropertyobj [ 'runEnvironment' ] = 'Cybersource.Environment.Production'
32+ merchantConfigObj = Merchantconfig . new cybsPropertyobj
33+ expect ( merchantConfigObj . requestHost ) . to eq 'api.cybersource.com'
34+ end
35+ it 'Validating RunEnvironment as default MerchantConfig File' do
36+ cybsPropertyobj = MerchantConfigData . new . merchantConfigProp
37+ cybsPropertyobj [ 'runEnvironment' ] = 'api.cybersource.com'
38+ merchantConfigObj = Merchantconfig . new cybsPropertyobj
39+ expect ( merchantConfigObj . requestHost ) . to eq 'api.cybersource.com'
40+ end
41+ it 'Validating MerchantId as empty in MerchantConfig File' do
42+ cybsPropertyobj = MerchantConfigData . new . merchantConfigProp
43+ cybsPropertyobj [ 'merchantID' ] = ''
44+ expect { Merchantconfig . new cybsPropertyobj } . to raise_error ( StandardError )
45+ end
46+ it 'Validating authenticationType as empty in MerchantConfig File' do
47+ cybsPropertyobj = MerchantConfigData . new . merchantConfigProp
48+ cybsPropertyobj [ 'authenticationType' ] = ''
49+ expect { Merchantconfig . new cybsPropertyobj } . to raise_error ( StandardError )
50+ end
51+ it 'Validating authenticationType as Fixnum in MerchantConfig File' do
52+ cybsPropertyobj = MerchantConfigData . new . merchantConfigProp
53+ cybsPropertyobj [ 'authenticationType' ] = 123
54+ expect { Merchantconfig . new cybsPropertyobj } . to raise_error ( StandardError )
55+ end
56+ it 'Validating keyAlias as Fixnum MerchantConfig File' do
57+ cybsPropertyobj = MerchantConfigData . new . merchantConfigProp
58+ cybsPropertyobj [ 'keyAlias' ] = 123
59+ merchantConfigObj = Merchantconfig . new cybsPropertyobj
60+ expect ( merchantConfigObj . keyAlias ) . to eq '123'
61+ end
62+ it 'Validating keyPass as Fixnum MerchantConfig File' do
63+ cybsPropertyobj = MerchantConfigData . new . merchantConfigProp
64+ cybsPropertyobj [ 'keyPass' ] = 123
65+ merchantConfigObj = Merchantconfig . new cybsPropertyobj
66+ expect ( merchantConfigObj . keyPass ) . to eq '123'
67+ end
68+ it 'Validating keysDirectory as Fixnum MerchantConfig File' do
69+ cybsPropertyobj = MerchantConfigData . new . merchantConfigProp
70+ cybsPropertyobj [ 'keysDirectory' ] = 123
71+ merchantConfigObj = Merchantconfig . new cybsPropertyobj
72+ expect ( merchantConfigObj . keysDirectory ) . to eq '123'
73+ end
74+ it 'Validating keyFilename as Fixnum MerchantConfig File' do
75+ cybsPropertyobj = MerchantConfigData . new . merchantConfigProp
76+ cybsPropertyobj [ 'keyFilename' ] = 123
77+ merchantConfigObj = Merchantconfig . new cybsPropertyobj
78+ expect ( merchantConfigObj . keyFilename ) . to eq '123'
79+ end
80+ it 'Validating keyAlias as empty MerchantConfig File' do
81+ cybsPropertyobj = MerchantConfigData . new . merchantConfigProp
82+ cybsPropertyobj [ 'keyAlias' ] = ''
83+ merchantConfigObj = Merchantconfig . new cybsPropertyobj
84+ expect ( merchantConfigObj . keyAlias ) . to eq 'testrest'
85+ end
86+ it 'Validating keyAlias not equal to merchantId MerchantConfig File' do
87+ cybsPropertyobj = MerchantConfigData . new . merchantConfigProp
88+ cybsPropertyobj [ 'keyAlias' ] = 'test'
89+ merchantConfigObj = Merchantconfig . new cybsPropertyobj
90+ expect ( merchantConfigObj . keyAlias ) . to eq 'testrest'
91+ end
92+ it 'Validating keyPass as empty MerchantConfig File' do
93+ cybsPropertyobj = MerchantConfigData . new . merchantConfigProp
94+ cybsPropertyobj [ 'keyPass' ] = ''
95+ merchantConfigObj = Merchantconfig . new cybsPropertyobj
96+ expect ( merchantConfigObj . keyPass ) . to eq 'testrest'
97+ end
98+ it 'Validating keyFilename as empty MerchantConfig File' do
99+ cybsPropertyobj = MerchantConfigData . new . merchantConfigProp
100+ cybsPropertyobj [ 'keyFilename' ] = ''
101+ merchantConfigObj = Merchantconfig . new cybsPropertyobj
102+ expect ( merchantConfigObj . keyFilename ) . to eq 'testrest'
103+ end
104+ it 'Validating merchantKeyId as empty MerchantConfig File' do
105+ cybsPropertyobj = MerchantConfigData . new . merchantConfigProp
106+ cybsPropertyobj [ 'merchantKeyId' ] = ''
107+ cybsPropertyobj [ 'authenticationType' ] = 'http_signature'
108+ expect { Merchantconfig . new cybsPropertyobj } . to raise_error ( StandardError )
109+ end
110+ it 'Validating merchantSecretKey as empty MerchantConfig File' do
111+ cybsPropertyobj = MerchantConfigData . new . merchantConfigProp
112+ cybsPropertyobj [ 'merchantsecretKey' ] = ''
113+ cybsPropertyobj [ 'authenticationType' ] = 'http_signature'
114+ expect { Merchantconfig . new cybsPropertyobj } . to raise_error ( StandardError )
115+ end
116+ end
0 commit comments