ucert 0.2.57
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +134 -0
- data/LICENSE.txt +22 -0
- data/README.rdoc +61 -0
- data/Rakefile +8 -0
- data/TODO +5 -0
- data/bin/ad_dump +74 -0
- data/bin/ad_update +48 -0
- data/bin/adgrep +149 -0
- data/bin/adp_dump +70 -0
- data/bin/aix_dump +69 -0
- data/bin/audiolog_dump +69 -0
- data/bin/bloomberg_dump +69 -0
- data/bin/check21_dump +69 -0
- data/bin/citidirect_be_dump +69 -0
- data/bin/citidirect_sec_dump +69 -0
- data/bin/citrixsf_dump +70 -0
- data/bin/clear_par_dump +70 -0
- data/bin/cmbrun_ny_dump +76 -0
- data/bin/cvm_dump +70 -0
- data/bin/db_direct_dump +69 -0
- data/bin/egifts_dump +68 -0
- data/bin/equinix_dump +69 -0
- data/bin/frb_dump +69 -0
- data/bin/go_contact_dump +16 -0
- data/bin/jpm_dump +69 -0
- data/bin/madison535_dump +70 -0
- data/bin/mantis_dump +79 -0
- data/bin/prime_dump +79 -0
- data/bin/sage100_dump +69 -0
- data/bin/sharefile_dump +69 -0
- data/bin/som_dump +74 -0
- data/bin/stb_dump +69 -0
- data/bin/swift_dump +79 -0
- data/bin/swift_online_dump +69 -0
- data/bin/t24_dump +79 -0
- data/bin/vpn_dump +69 -0
- data/bin/wms_dump +79 -0
- data/bin/yst_dump +79 -0
- data/data/ad/ad_delta.txt +94 -0
- data/data/ad/hosts +421 -0
- data/data/ad/hosts.old +597 -0
- data/data/ad/hosts_old +597 -0
- data/data/ad/ldap_computer.txt +19028 -0
- data/data/ad/ldap_person.txt +41241 -0
- data/data/adp/Active Employee Report.xlsx +0 -0
- data/data/adp/adp_user_map.txt +141 -0
- data/data/aix/EGIFTS1.txt +239 -0
- data/data/aix/NYSWIFT1.txt +222 -0
- data/data/aix/T24_APP1.txt +300 -0
- data/data/aix/T24_DBP.txt +252 -0
- data/data/aix/aix_user_map.txt +46 -0
- data/data/alliance_swift/Swift_Operator_Details.xlsx +0 -0
- data/data/alliance_swift/Swift_Operator_Profiles_Details.xlsx +0 -0
- data/data/alliance_swift/swift_operator_map.txt +22 -0
- data/data/audiolog/Capture_audiolog.PNG +0 -0
- data/data/bloomberg/AccountData.csv +2 -0
- data/data/bloomberg/Capture_SID_download.PNG +0 -0
- data/data/bloomberg/current_subscriptions.csv +11 -0
- data/data/check21/Capture_check21_users.PNG +0 -0
- data/data/citidirect_be/Capture.PNG +0 -0
- data/data/citidirect_be/Capture_new.PNG +0 -0
- data/data/citidirect_be/Capture_new_new.PNG +0 -0
- data/data/citidirect_be/UserProfileEntitlementReport.pdf +0 -0
- data/data/citidirect_be/UserProfileEntitlementsReport.old.xlsx +0 -0
- data/data/citidirect_be/UserProfileEntitlementsReport.xlsx +0 -0
- data/data/citidirect_be/be_user_map.txt +11 -0
- data/data/citidirect_securities/Capture.PNG +0 -0
- data/data/citidirect_securities/User_Entitlements_Report___CLNT.dat +19 -0
- data/data/citidirect_securities/User_Entitlements_Report___CLNT.xml +75 -0
- data/data/citidirect_securities/citidirect_securities_user_map.txt +10 -0
- data/data/citrix_sharefile/ShareFile_Access_Report.xlsx +0 -0
- data/data/citrix_sharefile/sharefile_user_map.txt +33 -0
- data/data/clear_par/ClearPar User Report.xlsx +0 -0
- data/data/clear_par/clear_par_user_map.txt +25 -0
- data/data/cmbrun_ny/CMBNY_Position_Rpt.xlsx +0 -0
- data/data/cmbrun_ny/CMBRUN_USER_RPT.xlsx +0 -0
- data/data/cmbrun_ny/Capture_cmbrun.PNG +0 -0
- data/data/cmbrun_ny/Capture_cmbrun_position.PNG +0 -0
- data/data/cmbrun_ny/crny_access_user_map.txt +55 -0
- data/data/cvm/cvm_user_func.xlsx +0 -0
- data/data/cvm/cvm_user_list.xlsx +0 -0
- data/data/cvm/cvm_user_map.txt +56 -0
- data/data/cvm/cvm_user_role.xlsx +0 -0
- data/data/db_direct/Capture_main.PNG +0 -0
- data/data/db_direct/Capture_rpt.PNG +0 -0
- data/data/db_direct/accountpermission.xlsx +0 -0
- data/data/db_direct/db_direct_user_map.txt +8 -0
- data/data/db_direct/di_direct_user_map.txt +0 -0
- data/data/db_direct/userfulldetail_2016010813232300644912.pdf +0 -0
- data/data/equinix/Secured Access List_CHINA MERCHANTS BANK.xlsx +0 -0
- data/data/equinix/equinix_user_map.txt +29 -0
- data/data/fis_egifts/CHINA_MERCHANTS_BANK_-_USER_ACCOUNT_FUNCTION_REPORT.xlsx +0 -0
- data/data/fis_egifts/egifts_user_map.txt +113 -0
- data/data/fis_prime/Prime_Operator_Rights_Report.xml +41958 -0
- data/data/fis_prime/Prime_Operator_Status_Report.xml +1827 -0
- data/data/fis_prime/Prime_Operators_and_Roles_Report.xml +1505 -0
- data/data/fis_prime/Prime_Rights_by_Role_Report.xml +22726 -0
- data/data/fis_prime/prime_user_map.txt +77 -0
- data/data/frb/FRB_Subscriber_Roles_Report.xlsx +0 -0
- data/data/frb/frb_user_map.txt +22 -0
- data/data/go_contact/go_contact.xlsx +0 -0
- data/data/go_contact/go_user_map.txt +134 -0
- data/data/go_contact/title_level_map.txt +141 -0
- data/data/jpm_access/Capture.PNG +0 -0
- data/data/jpm_access/jpm_access_user_map.txt +13 -0
- data/data/jpm_access/jpm_user_entitlements_details.txt +194 -0
- data/data/jpm_access/jpm_user_groupentitlements_details.txt +2 -0
- data/data/madison535/535madison_bldg_pass.xlsx +0 -0
- data/data/madison535/535madison_bldg_pass_2.xlsx +0 -0
- data/data/madison535/madison535_user_map.txt +191 -0
- data/data/mantis/Mantis_AccessLevels.xlsx +0 -0
- data/data/mantis/Mantis_ActiveUsers_Rpt.xlsx +0 -0
- data/data/mantis/mantis_access_user_map.txt +128 -0
- data/data/sage100/Capture_Sage100_Rpt.PNG +0 -0
- data/data/sage100/Capture_Sage100_Rpt_2.PNG +0 -0
- data/data/sage100/SY_UserReport_RolePreferencesDetails.xlsx +0 -0
- data/data/sage100/SY_UserReport_RoleTaskPermissionsDetails.xlsx +0 -0
- data/data/sage100/sy_user_map.txt +14 -0
- data/data/som/som_user_map.txt +40 -0
- data/data/som/som_user_report.csv +329 -0
- data/data/stb/STB_USERS.csv +177 -0
- data/data/stb/STB_USERS.pdf +0 -0
- data/data/stb/stb_user_map.txt +33 -0
- data/data/swift_online/UserReport.xlsx +0 -0
- data/data/swift_online/swo_access_user_map.txt +18 -0
- data/data/t24/T24_Grp_Rpt.csv +484 -0
- data/data/t24/T24_User_Rpt.csv +567 -0
- data/data/t24/t24_grp.xml +2904 -0
- data/data/t24/t24_user_map.txt +197 -0
- data/data/t24/t24_usr.xml +9628 -0
- data/data/vpn/Capture_VPN.PNG +0 -0
- data/data/wms/role_rpt.txt +451 -0
- data/data/wms/user_rpt.txt +55 -0
- data/data/wms/wms_user_map.txt +55 -0
- data/data/yst/YiShiTong_Org.csv +21 -0
- data/data/yst/YiShiTong_User.csv +163 -0
- data/data/yst/yst_user_map.txt +163 -0
- data/demos/filter_email.rb +19 -0
- data/demos/idm_ad_reload.rb +164 -0
- data/lib/ucert.rb +82 -0
- data/lib/ucert/ad_tracker.rb +694 -0
- data/lib/ucert/adp_payroll_tracker.rb +189 -0
- data/lib/ucert/aix_tracker.rb +175 -0
- data/lib/ucert/alliance_swift_tracker.rb +300 -0
- data/lib/ucert/audiolog_tracker.rb +67 -0
- data/lib/ucert/bloomberg_tracker.rb +96 -0
- data/lib/ucert/check21_tracker.rb +95 -0
- data/lib/ucert/citidirect_be_tracker.rb +418 -0
- data/lib/ucert/citidirect_securities_tracker.rb +230 -0
- data/lib/ucert/citrix_sharefile_tracker.rb +196 -0
- data/lib/ucert/clear_par_tracker.rb +187 -0
- data/lib/ucert/cmbrun_ny_tracker.rb +244 -0
- data/lib/ucert/cvm_tracker.rb +230 -0
- data/lib/ucert/db_direct_tracker.rb +205 -0
- data/lib/ucert/equinix_tracker.rb +202 -0
- data/lib/ucert/fis_egifts_tracker.rb +249 -0
- data/lib/ucert/fis_prime_tracker.rb +391 -0
- data/lib/ucert/frb_tracker.rb +232 -0
- data/lib/ucert/go_contact_tracker.rb +778 -0
- data/lib/ucert/jpm_access_tracker.rb +205 -0
- data/lib/ucert/madison535_tracker.rb +273 -0
- data/lib/ucert/mantis_tracker.rb +249 -0
- data/lib/ucert/sage100_tracker.rb +355 -0
- data/lib/ucert/som_tracker.rb +223 -0
- data/lib/ucert/stb_tracker.rb +199 -0
- data/lib/ucert/swift_online_tracker.rb +197 -0
- data/lib/ucert/t24_tracker.rb +342 -0
- data/lib/ucert/utils/utils.rb +200 -0
- data/lib/ucert/vpn_tracker.rb +94 -0
- data/lib/ucert/wms_tracker.rb +240 -0
- data/lib/ucert/yst_tracker.rb +264 -0
- data/test/ad_testfiles/ldap_computer_test.txt +21 -0
- data/test/ad_testfiles/ldap_person_test.txt +21 -0
- data/test/aix_testfiles/application1.txt +7 -0
- data/test/aix_testfiles/application2.txt +15 -0
- data/test/alliance_swift_testfiles/Swift_Operator_Details_Test.xlsx +0 -0
- data/test/alliance_swift_testfiles/Swift_Operator_Profiles_Details_Test.xlsx +0 -0
- data/test/alliance_swift_testfiles/swift_operator_map_test.txt +55 -0
- data/test/alliance_swift_testfiles/swift_operator_map_test_2.txt +55 -0
- data/test/alliance_swift_testfiles/swift_operator_map_test_format_fixed.txt +55 -0
- data/test/citidirect_be_testfiles/UserProfileEntitlementsReport_Test.xlsx +0 -0
- data/test/citidirect_securities_testfiles/User_Entitlements_Report___CLNT_Test.xml +48 -0
- data/test/citrix_sharefile_testfiles/ShareFile_Access_Report_Test.xlsx +0 -0
- data/test/cmbrun_ny_testfiles/CMBNY_Position_Rpt_02242016_test.xlsx +0 -0
- data/test/cmbrun_ny_testfiles/CMBRUN_USER_RPT_Test.xlsx +0 -0
- data/test/db_direct_testfiles/accountpermission_Test.xlsx +0 -0
- data/test/equinix_testfiles/Secured Access List_CHINA MERCHANTS BANK_TEST.xlsx +0 -0
- data/test/fis_egifts_testfiles/CHINA_MERCHANTS_BANK_-_USER_ACCOUNT_FUNCTION_REPORT_TEST.xlsx +0 -0
- data/test/fis_prime_testfiles/Prime_Operator_Rights_Report_Test.xml +158 -0
- data/test/fis_prime_testfiles/Prime_Operator_Status_Report_Copy.xml +1659 -0
- data/test/fis_prime_testfiles/Prime_Operator_Status_Report_Test.xml +51 -0
- data/test/fis_prime_testfiles/Prime_Operators_and_Roles_Report_Copy.xml +1360 -0
- data/test/fis_prime_testfiles/Prime_Operators_and_Roles_Report_Test.xml +45 -0
- data/test/fis_prime_testfiles/Prime_Rights_by_Role_Report_Test.xml +65 -0
- data/test/fis_prime_testfiles/prime_user_map.txt +3 -0
- data/test/frb_testfiles/FRB_Subscriber_Roles_Report_Test.xlsx +0 -0
- data/test/go_contact_testfiles/go_contact_test.xlsx +0 -0
- data/test/jpm_access_testfiles/Capture.PNG +0 -0
- data/test/jpm_access_testfiles/jpm_user_entitlements_details_original.txt +208 -0
- data/test/jpm_access_testfiles/jpm_user_entitlements_details_test.txt +7 -0
- data/test/madison535_testfiles/535madison_bldg_pass_2_Test.xlsx +0 -0
- data/test/madison535_testfiles/535madison_bldg_pass_Test.xlsx +0 -0
- data/test/mantis_testfiles/Mantis_AccessLevels_Test.xlsx +0 -0
- data/test/mantis_testfiles/Mantis_ActiveUsers_Rpt_Test.xlsx +0 -0
- data/test/sage100_testfiles/SY_UserReport_RolePreferencesDetails_Test.xlsx +0 -0
- data/test/sage100_testfiles/SY_UserReport_RoleTaskPermissionsDetails_Test.xlsx +0 -0
- data/test/som_testfiles/som_user_map_test.txt +7 -0
- data/test/som_testfiles/som_user_report_test.csv +25 -0
- data/test/stb_testfiles/STB_USERS_test.csv +24 -0
- data/test/stb_testfiles/STB_USERS_test_constant.csv +24 -0
- data/test/swift_online_testfiles/UserReport.xls +0 -0
- data/test/swift_online_testfiles/UserReport_Test.xlsx +0 -0
- data/test/swift_online_testfiles/test_outline_level.rb +7 -0
- data/test/t24_testfiles/T24_Grp_Rpt_Test.csv +7 -0
- data/test/t24_testfiles/T24_User_Rpt_Test.csv +7 -0
- data/test/test_ad_tracker.rb +148 -0
- data/test/test_aix_tracker.rb +71 -0
- data/test/test_alliance_swift_tracker.rb +131 -0
- data/test/test_audiolog_tracker.rb +23 -0
- data/test/test_check21_tracker.rb +30 -0
- data/test/test_citidirect_be_tracker.rb +110 -0
- data/test/test_citidirect_securities_tracker.rb +89 -0
- data/test/test_citrix_sharefile_tracker.rb +105 -0
- data/test/test_cmbrun_ny_tracker.rb +112 -0
- data/test/test_db_direct_tracker.rb +125 -0
- data/test/test_equinix_tracker.rb +119 -0
- data/test/test_fis_egifts_tracker.rb +105 -0
- data/test/test_fis_prime_tracker.rb +288 -0
- data/test/test_frb_tracker.rb +104 -0
- data/test/test_go_contact.rb +276 -0
- data/test/test_jpm_access_tracker.rb +122 -0
- data/test/test_madison535_tracker.rb +125 -0
- data/test/test_mantis_tracker.rb +133 -0
- data/test/test_sage100_tracker.rb +120 -0
- data/test/test_som_tracker.rb +71 -0
- data/test/test_stb_tracker.rb +120 -0
- data/test/test_swift_online_tracker.rb +116 -0
- data/test/test_t24_tracker.rb +151 -0
- data/test/test_utils.rb +46 -0
- data/test/test_vpn_tracker.rb +56 -0
- data/test/test_wms_tracker.rb +109 -0
- data/test/test_yst_tracker.rb +133 -0
- data/test/utils_testfiles/file2list_test.txt +13 -0
- data/test/utils_testfiles/load_know_user_map_testfile.txt +4 -0
- data/test/wms_testfiles/role_rpt_test.txt +6 -0
- data/test/wms_testfiles/user_rpt_test.txt +6 -0
- data/test/yst_testfiles/YiShiTong_Org_Test.csv +18 -0
- data/test/yst_testfiles/YiShiTong_User_Test.csv +5 -0
- data/ucert.gemspec +52 -0
- data/version.txt +12 -0
- metadata +410 -0
@@ -0,0 +1,7 @@
|
|
1
|
+
"@ID","DESCRIPTION","APPLICATION","VERSION","FUNCTION"
|
2
|
+
"TEST1-1","TEST1-2","TEST1-3","TEST1-4","TEST1-5"
|
3
|
+
"TEST2-1","TEST2-2","TEST2-3","TEST2-4","TEST2-5"
|
4
|
+
"","","TEST2-3-1","","TEST2-3-1"
|
5
|
+
"TEST3-1","TEST3-2","TEST3-3","TEST3-4","TEST3-5"
|
6
|
+
"","","TEST3-3-1","","TEST3-3-1"
|
7
|
+
"","","TEST3-3-2","","TEST3-3-2"
|
@@ -0,0 +1,7 @@
|
|
1
|
+
"@ID","USER.NAME","APPLICATION","FUNCTION","START.DATE.PROFILE","END.DATE.PROFILE","PASSWORD.VALIDITY","ATTRIBUTES","INIT.APPLICATION","ATTEMPTS","COMPANY.CODE","SECURITY.MGMT.L","TIME.OUT.MINUTES","DATE.LAST.SIGN.ON","TIME.LAST.SIGN.ON","PASSW.CHANGE.DATE"
|
2
|
+
"TEST1-1","TEST1-2","TEST1-3","TEST1-4","TEST1-5","TEST1-6","TEST1-7","TEST1-8","TEST1-9","TEST1-10","TEST1-11","TEST1-12","TEST1-13","TEST1-14","TEST1-15","TEST1-16"
|
3
|
+
"TEST2-1","TEST2-2","@TEST2-3","","TEST2-5","TEST2-6","TEST2-7","TEST2-8","TEST2-9","TEST2-10","TEST2-11","TEST2-12","TEST2-13","TEST2-14","TEST2-15","TEST2-16"
|
4
|
+
"","","TEST2-3-1","TEST2-3-1","","","","","","","","","","","",""
|
5
|
+
"TEST3-1","TEST3-2","@TEST3-3","","TEST3-5","TEST3-6","TEST3-7","TEST3-8","TEST3-9","TEST3-10","TEST3-11","TEST3-12","TEST3-13","TEST3-14","TEST3-15","TEST3-16"
|
6
|
+
"","","TEST3-3-1","TEST3-3-1","","","","","","","","","","","",""
|
7
|
+
"","","TEST3-3-2","TEST3-3-2","","","","","","","","","","","",""
|
@@ -0,0 +1,148 @@
|
|
1
|
+
require "minitest/autorun"
|
2
|
+
require "ucert"
|
3
|
+
|
4
|
+
#overriding initialize method for loading test_files
|
5
|
+
class Tracker_Ad < Ucert::AdTracker
|
6
|
+
|
7
|
+
attr_accessor :ad_person_records,:ad_computer_records
|
8
|
+
|
9
|
+
def initialize (params ={})
|
10
|
+
@verbose=params.fetch(:verbose, false)
|
11
|
+
@ldapsearch_cache_person=File.dirname(__FILE__)+"/ad_testfiles/ldap_person_test.txt"
|
12
|
+
@ldapsearch_cache_computer=File.dirname(__FILE__)+"/ad_testfiles/ldap_computer_test.txt"
|
13
|
+
@hosts_cache=File.dirname(__FILE__)+"/ad_testfiles/hosts_test"
|
14
|
+
@ad_delta_map=File.dirname(__FILE__)+"/ad_testfiles/ad_delta_test.txt"
|
15
|
+
@ad_person_records = Hash.new
|
16
|
+
@ad_computer_records = Hash.new
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class TestAdTracker < Minitest::Test
|
21
|
+
def setup
|
22
|
+
@ad_tracker = Ucert::AdTracker.new(:verbose=>false)
|
23
|
+
@tracker_ad = Tracker_Ad.new(:verbose=>false) #for test use
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_ldap_server_is_bind
|
27
|
+
assert @ad_tracker.is_ldap_bind?
|
28
|
+
@ad_tracker = Ucert::AdTracker.new(:ldap_port=>"388")
|
29
|
+
refute @ad_tracker.is_ldap_bind?
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_load_known_hosts
|
33
|
+
File.open(File.dirname(__FILE__)+"/ad_testfiles/hosts_test", "w") do |f|
|
34
|
+
f.write "# local hosts file created"
|
35
|
+
f.write "\ntest1.ny.cmbchina.com\t192.168.0.10"
|
36
|
+
f.write "\ntest2.ny.cmbchina.com\t192.168.0.11"
|
37
|
+
end
|
38
|
+
result_host=@ad_tracker.send(:load_known_hosts,File.dirname(__FILE__)+"/ad_testfiles/hosts_test")
|
39
|
+
test_host={"test1.ny.cmbchina.com"=>"192.168.0.10", "test2.ny.cmbchina.com"=>"192.168.0.11"}
|
40
|
+
assert_equal test_host, result_host
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_parse_openldap_cache
|
44
|
+
@tracker_ad.send(:parse_openldap_cache, "person")
|
45
|
+
@tracker_ad.send(:parse_openldap_cache, "computer")
|
46
|
+
test_person_record={"test1"=>["a:apple", "b:banana", "c:cucumber"], "test2"=>["d:dog", "e:elephant", "f:frog"], "test3"=>["g:greed", "h:hell", "i:innocent"]}
|
47
|
+
test_computer_record={"test1"=>["a:apple", "b:banana", "c:cucumber"], "test2"=>["d:dog", "e:elephant", "f:frog"], "test3"=>["g:greed", "h:hell", "i:innocent"]}
|
48
|
+
assert_equal test_person_record, @tracker_ad.ad_person_records
|
49
|
+
assert_equal test_computer_record, @tracker_ad.ad_computer_records
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_ad_search_by_text
|
53
|
+
@tracker_ad.ad_person_records={"test1"=>["a:apple", "b:banana", "c:cucumber"], "test2"=>["d:a pple", "e:ba nana", "f:cucum ber"]}
|
54
|
+
assert_equal "test2", @tracker_ad.send(:ad_search_by_text,"pple a")
|
55
|
+
assert_equal "test2", @tracker_ad.send(:ad_search_by_text,"ba nana")
|
56
|
+
assert_equal "test1", @tracker_ad.send(:ad_search_by_text,"apple")
|
57
|
+
refute @tracker_ad.send(:ad_search_by_text, "a big apple")
|
58
|
+
@tracker_ad.ad_computer_records={"test1"=>["a:adam", "b:bob", "c:chris"], "test2"=>["d:a dam", "e:b ob", "f:c hris"]}
|
59
|
+
assert_equal "test1", @tracker_ad.send(:ad_search_by_text, "a adam", "computer")
|
60
|
+
refute @tracker_ad.send(:ad_search_by_text, "leo", "computer")
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_ad_searchs_by_text
|
64
|
+
@tracker_ad.ad_person_records={"test1"=>["a:apple", "b:banana", "c:cucumber"], "test2"=>["d:pple a", "e:ba nana", "f:cucum ber"],"test3"=>["g:greed", "h:hell", "i:innocent"]}
|
65
|
+
#the order should be ["best match","close match"]
|
66
|
+
assert_equal ["test2", "test1"], @tracker_ad.send(:ad_searches_by_text,"a pple")
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_get_dn_attribute
|
70
|
+
@tracker_ad.ad_person_records={"test1"=>["a:apple", "b:banana", "c:cucumber"], "test2"=>["d:a pple", "e:ba nana", "f:cucum ber"]}
|
71
|
+
assert_equal "banana", @tracker_ad.send(:get_dn_attribute,"test1","b")
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_get_dn_attributes
|
75
|
+
@tracker_ad.ad_person_records={"test1"=>["a:apple", "a:banana", "a:cucumber", "b:pear"]}
|
76
|
+
assert_equal ["apple", "banana", "cucumber"], @tracker_ad.send(:get_dn_attributes, "person", "test1", "a")
|
77
|
+
end
|
78
|
+
|
79
|
+
#method may update, test will fail for now.
|
80
|
+
def test_get_dn_attribute_and_cntl_code_2_property_flag
|
81
|
+
acct_cntl_code={"SCRIPT"=>1, "ACCOUNTDISABLE"=>2, "HOMEDIR_REQUIRED"=>8, "LOCKOUT"=>16, "PASSWD_NOTREQD"=>32, \
|
82
|
+
"PASSWD_CANT_CHANGE"=>64, "ENCRYPTED_TEXT_PWD_ALLOWED"=>128, "TEMP_DUPLICATE_ACCOUNT"=>256, "NORMAL_ACCOUNT"=>512, \
|
83
|
+
"INTERDOMAIN_TRUST_ACCOUNT"=>2048, "WORKSTATION_TRUST_ACCOUNT"=>4096, "SERVER_TRUST_ACCOUNT"=>8192, \
|
84
|
+
"DONT_EXPIRE_PASSWORD"=>65536, "MNS_LOGON_ACCOUNT"=>131072, "SMARTCARD_REQUIRED"=>262144, \
|
85
|
+
"TRUSTED_FOR_DELEGATION"=>524288, "NOT_DELEGATED"=>1048576, "USE_DES_KEY_ONLY"=>2097152, "DONT_REQ_PREAUTH"=>4194304, \
|
86
|
+
"PASSWORD_EXPIRED"=>8388608, "TRUSTED_TO_AUTH_FOR_DELEGATION"=>16777216, "PARTIAL_SECRETS_ACCOUNT"=>67108864}
|
87
|
+
test_array=Array.new
|
88
|
+
invert_acct=acct_cntl_code.invert
|
89
|
+
@ad_tracker.ad_person_records.each do |key, value|
|
90
|
+
test_array.push(@ad_tracker.get_dn_attribute("person",key,"userAccountControl"))
|
91
|
+
end
|
92
|
+
test_array.uniq!
|
93
|
+
test_array.each do |num|
|
94
|
+
puts "-----------------------------"
|
95
|
+
test_control=Array.new
|
96
|
+
puts num
|
97
|
+
binary_num=num.to_i.to_s(2)
|
98
|
+
puts binary_num
|
99
|
+
puts binary_num.reverse
|
100
|
+
for pos in 0...binary_num.length
|
101
|
+
if binary_num.reverse[pos]=="1"
|
102
|
+
puts pos
|
103
|
+
puts invert_acct[2**pos]
|
104
|
+
test_control.push(invert_acct[2**pos])
|
105
|
+
end
|
106
|
+
end
|
107
|
+
assert_equal test_control.sort, @ad_tracker.send(:cntl_code_2_property_flag, num).strip.split(" + ").sort
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
def test_save_hosts
|
112
|
+
@ad_tracker.send(:save_hosts, File.dirname(__FILE__)+"/ad_testfiles/hosts_test")
|
113
|
+
line_count=1
|
114
|
+
File.open(File.dirname(__FILE__)+"/ad_testfiles/hosts_test", 'r').each_line do |line|
|
115
|
+
if line_count==1
|
116
|
+
assert_match (/\# local hosts file created by the .+ class .+ method at: .+/), line
|
117
|
+
else
|
118
|
+
dn=line.split("\t")[0].strip
|
119
|
+
ip=line.split("\t")[1].strip
|
120
|
+
unless dn.empty?
|
121
|
+
assert_equal ip, @ad_tracker.known_hosts[dn]
|
122
|
+
end
|
123
|
+
end
|
124
|
+
line_count+=1
|
125
|
+
end
|
126
|
+
File.delete(File.dirname(__FILE__)+"/ad_testfiles/hosts_test")
|
127
|
+
end
|
128
|
+
|
129
|
+
#test will fail since one ip may have mutiple host_names, method will only return the first match
|
130
|
+
def test_local_ip_2_host
|
131
|
+
=begin
|
132
|
+
@ad_tracker.send(:save_hosts, File.dirname(__FILE__)+"/ad_testfiles/hosts_test")
|
133
|
+
line_count=1
|
134
|
+
File.open(File.dirname(__FILE__)+"/ad_testfiles/hosts_test", 'r').each_line do |line|
|
135
|
+
if line_count>1
|
136
|
+
dn=line.split("\t")[0].strip
|
137
|
+
ip=line.split("\t")[1].strip
|
138
|
+
unless dn.empty?
|
139
|
+
assert_equal dn, @ad_tracker.send(:local_ip_2_host, ip)
|
140
|
+
end
|
141
|
+
end
|
142
|
+
line_count+=1
|
143
|
+
end
|
144
|
+
File.delete(File.dirname(__FILE__)+"/ad_testfiles/hosts_test")
|
145
|
+
=end
|
146
|
+
end
|
147
|
+
|
148
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require "minitest/autorun"
|
2
|
+
require "ucert"
|
3
|
+
|
4
|
+
class TestAixTracker < Minitest::Test
|
5
|
+
|
6
|
+
def setup
|
7
|
+
@aix_tracker = Ucert::AixTracker.new(:verbose=>false)
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_instance_initialize_success
|
11
|
+
refute_nil @aix_tracker.aix_passwd_file_list
|
12
|
+
#refute_nil @aix_tracker.aix_user_status_report
|
13
|
+
refute_nil @aix_tracker.file_aix_user_map
|
14
|
+
refute_nil @aix_tracker.aix_2_ad_user
|
15
|
+
refute_nil @aix_tracker.aix_user_entitlement
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_parse_aix_passwd_files_method
|
19
|
+
@test_entitlement=@aix_tracker.send(:parse_aix_passwd_files, [File.dirname(__FILE__)+"/aix_testfiles/application1.txt",File.dirname(__FILE__)+"/aix_testfiles/application2.txt"])
|
20
|
+
assert_equal 2, @test_entitlement["test"]["accesses"].size
|
21
|
+
assert_equal "1", @test_entitlement["foobar"]["accesses"]["application2"]["id"]
|
22
|
+
end
|
23
|
+
|
24
|
+
#method index should be username not number, so the test will fail
|
25
|
+
def test_dn_2_index_method
|
26
|
+
#refute_nil @aix_tracker.send(:dn_2_index, "CN=nyadmin,OU=SystemManagement,DC=ny,DC=cmbchina,DC=com")
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_insert_dn
|
30
|
+
@aix_tracker.aix_user_entitlement.each do |index, user|
|
31
|
+
dn_regex=/\ACN=.+\,OU=.+\,DC=ny,DC=cmbchina,DC=com\z/
|
32
|
+
assert_match dn_regex, user["DN"] unless user["DN"].nil?
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_print_user_entitlement
|
37
|
+
assert_output(/./) {@aix_tracker.print_user}
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_save_aix_user_map!
|
41
|
+
@aix_tracker.send(:save!, File.dirname(__FILE__)+"/aix_testfiles/aix_user_map_test.txt")
|
42
|
+
line_count=1
|
43
|
+
File.open(File.dirname(__FILE__)+"/aix_testfiles/aix_user_map_test.txt", 'r').each_line do |line|
|
44
|
+
if line_count==1
|
45
|
+
assert_match (/\# local AIX to AD user map file created by the .+ class .+ method at: .+/), line
|
46
|
+
else
|
47
|
+
user_name=line.split("|")[0]
|
48
|
+
line.split("|")[1].nil? ? dn="" : dn=line.split("|")[1].strip
|
49
|
+
if dn.empty?
|
50
|
+
assert_nil @aix_tracker.aix_user_entitlement[user_name]["DN"]
|
51
|
+
else
|
52
|
+
assert_equal @aix_tracker.aix_user_entitlement[user_name]["DN"], dn
|
53
|
+
end
|
54
|
+
end
|
55
|
+
line_count+=1
|
56
|
+
end
|
57
|
+
File.delete(File.dirname(__FILE__)+"/aix_testfiles/aix_user_map_test.txt")
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_db_search_by_dn
|
61
|
+
index=0
|
62
|
+
File.open(@aix_tracker.file_aix_user_map, 'r').each_line do |line|
|
63
|
+
if index>0
|
64
|
+
line.split("|")[1].nil? ? dn="" : dn=line.split("|")[1].strip
|
65
|
+
assert_equal dn, @aix_tracker.send(:search_by_dn, dn)['DN'] unless dn.empty?
|
66
|
+
end
|
67
|
+
index=index+1
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
@@ -0,0 +1,131 @@
|
|
1
|
+
require "minitest/autorun"
|
2
|
+
require "ucert"
|
3
|
+
|
4
|
+
class SwiftTestTracker < Ucert::AllianceSwiftTracker
|
5
|
+
attr_accessor :verbose, :swift_operator_details_report, :swift_operator_profile_details_report, :file_operator_map
|
6
|
+
attr_reader :swift_operator_entitlement, :swift_operator_profiles, :swift_2_ad_operator
|
7
|
+
# Instance default variables
|
8
|
+
def initialize (params ={})
|
9
|
+
@verbose=params.fetch(:verbose, false)
|
10
|
+
@swift_operator_details_report = File.dirname(__FILE__)+"/alliance_swift_testfiles/Swift_Operator_Details_Test.xlsx"
|
11
|
+
@swift_operator_profile_details_report = File.dirname(__FILE__)+"/alliance_swift_testfiles/Swift_Operator_Profiles_Details_Test.xlsx"
|
12
|
+
@file_operator_map = File.dirname(__FILE__)+"/alliance_swift_testfiles/swift_operator_map_test.txt"
|
13
|
+
@swift_2_ad_operator=load_known_user_map_from_file(@file_operator_map)
|
14
|
+
@swift_operator_entitlement=Hash.new
|
15
|
+
parse_swift_operator_details_report(@swift_operator_details_report)
|
16
|
+
@swift_operator_profiles=Hash.new
|
17
|
+
parse_swift_operator_profile_details_report(@swift_operator_profile_details_report)
|
18
|
+
insert_dn
|
19
|
+
save!
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class TestAllianceSwiftTracker < Minitest::Test
|
24
|
+
|
25
|
+
FileUtils.cp_r(File.dirname(__FILE__)+"/../data/alliance_swift/swift_operator_map.txt", File.dirname(__FILE__)+"/alliance_swift_testfiles/swift_operator_map_test.txt")
|
26
|
+
|
27
|
+
def setup
|
28
|
+
@test_swift_tracker = SwiftTestTracker.new(:verbose=>false)
|
29
|
+
@swift_tracker = Ucert::AllianceSwiftTracker.new(:verbose=>false)
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_instance_initialize_success
|
33
|
+
refute_nil @swift_tracker.swift_operator_details_report
|
34
|
+
refute_nil @swift_tracker.swift_operator_profile_details_report
|
35
|
+
refute_nil @swift_tracker.file_operator_map
|
36
|
+
refute_nil @swift_tracker.swift_2_ad_operator
|
37
|
+
refute_nil @swift_tracker.swift_operator_entitlement
|
38
|
+
refute_nil @swift_tracker.swift_operator_profiles
|
39
|
+
end
|
40
|
+
|
41
|
+
#the method will use private variable swift_operator_entitlement for self sanity quick checking so cannot use testfiles
|
42
|
+
def test_parse_swift_operator_details_report
|
43
|
+
user1=["BAISHUO780","Shuo Bai; F&A","Approved/Disabled","2014/12/15 10:41:25","Human","Password","","R7.0_SysOper","None"]
|
44
|
+
user1.all? do |e|
|
45
|
+
assert_includes @test_swift_tracker.swift_operator_entitlement[1].values, e
|
46
|
+
end
|
47
|
+
user50=["egifts","eGiftes System User","Approved/Enabled","2016/11/24 02:17:09","Human","Password","","R62_SuperKeyPLUS","None"]
|
48
|
+
user50.all? do |e|
|
49
|
+
assert_includes @test_swift_tracker.swift_operator_entitlement[54].values, e
|
50
|
+
end
|
51
|
+
assert_equal 54, @test_swift_tracker.swift_operator_entitlement.size
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_parse_swift_operator_profile_details_report
|
55
|
+
operator1=Hash.new
|
56
|
+
operator1['Name']="R6.2_CFO"
|
57
|
+
operator1["Access Control"]=Hash.new
|
58
|
+
operator1["Access Control"]={"Files On User Space"=>[], "Signon"=>["Permissions =", "Start time: 0000", "End time: 2357", "Start time: 2358", "End time: 2359", "WS Session Timeout: 0", ""]}
|
59
|
+
assert_equal operator1['Name'], @test_swift_tracker.swift_operator_profiles[1]['Name']
|
60
|
+
assert_equal operator1["Access Control"], @test_swift_tracker.swift_operator_profiles[1]["Entities"]["Access Control"]
|
61
|
+
assert_equal 43, @test_swift_tracker.swift_operator_profiles.size
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_insert_dn
|
65
|
+
@test_swift_tracker.swift_operator_entitlement.each do |index, user|
|
66
|
+
dn_regex=/\ACN=.+\,OU=.+\,DC=ny,DC=cmbchina,DC=com\z/
|
67
|
+
assert_match dn_regex, user["DN"] unless user["DN"].nil?
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_operator_name_2_index
|
72
|
+
line_cnt=1
|
73
|
+
File.open(File.dirname(__FILE__)+"/alliance_swift_testfiles/swift_operator_map_test.txt", 'r').each_line do |line|
|
74
|
+
if line_cnt>1
|
75
|
+
name=line.split(":")[0]
|
76
|
+
# @test_swift_tracker.swift_operator_entitlement
|
77
|
+
assert_equal line_cnt-1, @swift_tracker.send(:operator_name_2_index, name)
|
78
|
+
end
|
79
|
+
line_cnt+=1
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def test_print_operator_entitlement
|
84
|
+
assert_output(/./) { @test_swift_tracker.print_operators}
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_print_operator_profiles
|
88
|
+
assert_output(/./) { @test_swift_tracker.print_profiles}
|
89
|
+
end
|
90
|
+
|
91
|
+
#test will fail for the map's format is not adjusted
|
92
|
+
def test_save_swift_operator_map!
|
93
|
+
@swift_tracker.send(:save!, File.dirname(__FILE__)+"/alliance_swift_testfiles/swift_operator_map_test_2.txt")
|
94
|
+
#test_files=["swift_operator_map_test_format_fixed.txt","swift_operator_map_test.txt"]
|
95
|
+
test_files=["swift_operator_map_test_2.txt"]
|
96
|
+
test_files.each do |testfile|
|
97
|
+
line_count=0
|
98
|
+
puts "This is the test for "+testfile
|
99
|
+
File.open(File.dirname(__FILE__)+"/alliance_swift_testfiles/"+testfile, 'r').each_line do |line|
|
100
|
+
if line_count==0
|
101
|
+
assert_match (/\# local Swift to AD operator map file created by the .+ class .+ method at: .+/), line
|
102
|
+
else
|
103
|
+
user_name=line.split(":")[0]
|
104
|
+
description=line.split(":")[1].split("|")[0]
|
105
|
+
dn=line.split(":")[1].split("|")[1].nil? ? dn="" : dn=line.split(":")[1].split("|")[1].strip
|
106
|
+
assert_equal @swift_tracker.swift_operator_entitlement[line_count]["Name"].upcase, user_name
|
107
|
+
assert_equal @swift_tracker.swift_operator_entitlement[line_count]["Description"].upcase.gsub(/\s+/, ' ').strip, description
|
108
|
+
if dn.empty?
|
109
|
+
assert_nil @swift_tracker.swift_operator_entitlement[line_count]["DN"]
|
110
|
+
else
|
111
|
+
#puts @test_swift_tracker.swift_operator_entitlement[line_count]
|
112
|
+
assert_equal @swift_tracker.swift_operator_entitlement[line_count]["DN"], dn
|
113
|
+
end
|
114
|
+
end
|
115
|
+
line_count+=1
|
116
|
+
end
|
117
|
+
puts "Passed"
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
def test_swift_search_by_dn
|
122
|
+
index=0
|
123
|
+
File.open(File.dirname(__FILE__)+"/alliance_swift_testfiles/swift_operator_map_test.txt", 'r').each_line do |line|
|
124
|
+
if index>0
|
125
|
+
line.split("|")[1].nil? ? dn="" : dn=line.split("|")[1].strip
|
126
|
+
assert_equal dn, @swift_tracker.send(:search_by_dn, dn)['DN'] unless dn.empty?
|
127
|
+
end
|
128
|
+
index=index+1
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require "minitest/autorun"
|
2
|
+
require "ucert"
|
3
|
+
|
4
|
+
class TestAudiologTracker < Minitest::Test
|
5
|
+
|
6
|
+
def setup
|
7
|
+
@audiolog_tracker = Ucert::AudiologTracker.new(:verbose=>false)
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_instance_initialize_success
|
11
|
+
refute_nil @audiolog_tracker.audiolog_user
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_print_user
|
15
|
+
$stdout = StringIO.new
|
16
|
+
@audiolog_tracker.print_user
|
17
|
+
items=$stdout.string.split("\n")
|
18
|
+
items.each do |line|
|
19
|
+
assert_match (/\A.+\|.+\|.+\|.*\|\z/), line
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require "minitest/autorun"
|
2
|
+
require "ucert"
|
3
|
+
|
4
|
+
class TestCheck21Tracker < Minitest::Test
|
5
|
+
|
6
|
+
def setup
|
7
|
+
@check21_tracker = Ucert::Check21Tracker.new(:verbose=>false)
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_instance_initialize_success
|
11
|
+
refute_nil @check21_tracker.check21_user_entitlement
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_parse_check21_user_info
|
15
|
+
titles=["CN","department","sAMAccountName","DN"]
|
16
|
+
@check21_tracker.check21_user_entitlement.each do|index, content|
|
17
|
+
assert_equal titles, content.keys
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_print_user
|
22
|
+
$stdout = StringIO.new
|
23
|
+
@check21_tracker.print_user
|
24
|
+
items=$stdout.string.split("\n")
|
25
|
+
items.each do |line|
|
26
|
+
assert_match (/\A.+\|.*\|.+\|.*\|\z/), line
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
require "minitest/autorun"
|
2
|
+
require "ucert"
|
3
|
+
|
4
|
+
class TestCitidirectBETracker < Minitest::Test
|
5
|
+
|
6
|
+
def setup
|
7
|
+
@citi_be_tracker = Ucert::CitidirectBETracker.new(:verbose=>false)
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_instance_initialize_success
|
11
|
+
refute_nil @citi_be_tracker.file_be_user_map
|
12
|
+
refute_nil @citi_be_tracker.be_2_ad_user
|
13
|
+
refute_nil @citi_be_tracker.be_user_entitlement
|
14
|
+
#puts @citi_be_tracker.be_user_entitlement
|
15
|
+
end
|
16
|
+
|
17
|
+
#Two reasons for test failure:
|
18
|
+
#1:The "Assigned_Access_Profiles" field is not loaded correctly, the code for assign cur_profiles line:138 is not executed due to the 'next' code in
|
19
|
+
# include?("Assigned Access Profiles") line:95 breaks the loop, which also caused "Billing Account Number" inforamtion not assigned correctly.
|
20
|
+
#2:The format for "Credential Type" and "Credential ID" is different from previous column, the key and value are vertical but not horizonal.
|
21
|
+
def test_parse_be_user_entitlement_report
|
22
|
+
@test_citi_be_entitlement=@citi_be_tracker.send(:parse_be_user_entitlement_report, File.dirname(__FILE__)+"/citidirect_be_testfiles/UserProfileEntitlementsReport_Test.xlsx")
|
23
|
+
assert_equal 3, @test_citi_be_entitlement.size
|
24
|
+
@test_citi_be_entitlement.each do |index, user|
|
25
|
+
user.each do |key, value|
|
26
|
+
if key=="Assigned_Access_Profiles"
|
27
|
+
#refute value.empty?
|
28
|
+
value.each do |title, content|
|
29
|
+
assert_equal "test#{index}-"+title, content
|
30
|
+
end
|
31
|
+
elsif value.include?(" ")
|
32
|
+
key_trans=key.gsub('_',' ')
|
33
|
+
assert_equal "test#{index}-"+key_trans, value
|
34
|
+
elsif value.include?("/")
|
35
|
+
key_trans=key.gsub('_','/')
|
36
|
+
assert_equal "test#{index}-"+key_trans, value
|
37
|
+
else
|
38
|
+
assert_equal "test#{index}-"+key, value
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_dn_2_index
|
45
|
+
line_cnt=1
|
46
|
+
File.open(@citi_be_tracker.file_be_user_map, 'r').each_line do |line|
|
47
|
+
if line_cnt>1
|
48
|
+
dn=line.split("|")[1].strip
|
49
|
+
assert_equal line_cnt-1, @citi_be_tracker.send(:dn_2_index, dn)
|
50
|
+
end
|
51
|
+
line_cnt+=1
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_insert_dn
|
56
|
+
@citi_be_tracker.be_user_entitlement.each do |index, user|
|
57
|
+
dn_regex=/\ACN=.+\,OU=.+\,DC=ny,DC=cmbchina,DC=com\z/
|
58
|
+
assert_match dn_regex, user["DN"] unless user["DN"].nil?
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
#The test will fail because some user's Building Floor inforamtion is blank, so in the entitlement the building floor filed is nil,
|
63
|
+
#then some user will have 19 fields but some only have 18.
|
64
|
+
def test_print_user_entitlement
|
65
|
+
column_num=Array.new
|
66
|
+
@citi_be_tracker.be_user_entitlement.values.map do |rec|
|
67
|
+
column_num.push(rec.each.size)
|
68
|
+
end
|
69
|
+
assert_equal 1, column_num.uniq!.size
|
70
|
+
$stdout = StringIO.new
|
71
|
+
@citi_be_tracker.print_user.each
|
72
|
+
items=$stdout.string.split("\n")
|
73
|
+
items.each do |line|
|
74
|
+
assert_equal column_num[0], line.count("|")
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_save_be_user_map
|
79
|
+
@citi_be_tracker.send(:save!, File.dirname(__FILE__)+"/citidirect_be_testfiles/be_user_map_test.txt")
|
80
|
+
line_count=0
|
81
|
+
File.open(File.dirname(__FILE__)+"/citidirect_be_testfiles/be_user_map_test.txt", 'r').each_line do |line|
|
82
|
+
if line_count==0
|
83
|
+
assert_match (/\# local Citidirect BE to AD user map file created by the .+ class .+ method at: .+/), line
|
84
|
+
else
|
85
|
+
email=line.split("|")[0]
|
86
|
+
dn=line.split("|")[1].nil? ? dn="" : dn=line.split("|")[1].strip
|
87
|
+
assert_equal @citi_be_tracker.be_user_entitlement[line_count]["E-Mail_Address"].upcase, email
|
88
|
+
if dn.empty?
|
89
|
+
assert_nil @citi_be_tracker.be_user_entitlement[line_count]["DN"]
|
90
|
+
else
|
91
|
+
assert_equal @citi_be_tracker.be_user_entitlement[line_count]["DN"], dn
|
92
|
+
end
|
93
|
+
end
|
94
|
+
line_count+=1
|
95
|
+
end
|
96
|
+
File.delete(File.dirname(__FILE__)+"/citidirect_be_testfiles/be_user_map_test.txt")
|
97
|
+
end
|
98
|
+
|
99
|
+
def test_be_search_by_dn
|
100
|
+
index=0
|
101
|
+
File.open(@citi_be_tracker.file_be_user_map, 'r').each_line do |line|
|
102
|
+
if index>0
|
103
|
+
dn=line.split("|")[1].nil? ? dn="" : dn=line.split("|")[1].strip
|
104
|
+
assert_equal dn, @citi_be_tracker.send(:search_by_dn, dn)['DN'] unless dn.empty?
|
105
|
+
end
|
106
|
+
index=index+1
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|