From 322b313897d096c2b705325f0ae4a832c7dada7e Mon Sep 17 00:00:00 2001 From: Ian Costanzo Date: Thu, 6 Sep 2018 10:35:49 -0700 Subject: [PATCH] Unit tests in progress --- .../bcreg/tests/bcreg_test_dev_corps.py | 46 +++++++++++++++ .../bcreg/tests/bcreg_test_prod_corps.py | 55 ++++++++++++++++++ doc/BCReg-DBA-Data-Model.png | Bin 45709 -> 45709 bytes doc/BCReg-Data-Model.png | Bin 51911 -> 51911 bytes doc/Event-Processor-Data-Model.png | Bin 18365 -> 18365 bytes doc/Event-Processor.png | Bin 80925 -> 80925 bytes 6 files changed, 101 insertions(+) create mode 100644 data-pipeline/bcreg/tests/bcreg_test_dev_corps.py create mode 100644 data-pipeline/bcreg/tests/bcreg_test_prod_corps.py diff --git a/data-pipeline/bcreg/tests/bcreg_test_dev_corps.py b/data-pipeline/bcreg/tests/bcreg_test_dev_corps.py new file mode 100644 index 0000000..152c707 --- /dev/null +++ b/data-pipeline/bcreg/tests/bcreg_test_dev_corps.py @@ -0,0 +1,46 @@ + +import time + +from bcreg.bcregistries import BCRegistries, system_type +from bcreg.eventprocessor import EventProcessor +from bcreg.tests.sample_corps import sample_test_corps + + +def test_dev_corp_sql(): + specific_corps = [ + #'0574972', + '0657791' + ] + + with BCRegistries(True) as bc_registries: + for corp in specific_corps: + #print('=========================') + print('===== ', corp) + bc_registries.cache_bcreg_corp_tables([corp], True) + sqls = bc_registries.generated_sqls + fake_corp_num = bc_registries.add_generated_corp_num(corp) + print('=============>>> ', fake_corp_num) + #print('=========================') + #print('sqls:') + #for sql in sqls: + # print('"""' + sql.replace(' values ', '\nvalues\n') + '""",') + #print('=========================') + + with BCRegistries(True) as cached_bc_reg: + cached_bc_reg.cache_bcreg_code_tables() + cached_bc_reg.insert_cache_sqls(sqls) + + # try running with dummy event id zero + corp_info = cached_bc_reg.get_bc_reg_corp_info(fake_corp_num, 0) + #print('-------------------------') + #print('corp_info:') + #print(corp_info) + #print('-------------------------') + + with EventProcessor() as event_processor: + corp_creds = event_processor.generate_credentials(system_type, 0, 0, fake_corp_num, corp_info) + #print('-------------------------') + #print('corp_creds:') + #print(corp_creds) + #print('-------------------------') + diff --git a/data-pipeline/bcreg/tests/bcreg_test_prod_corps.py b/data-pipeline/bcreg/tests/bcreg_test_prod_corps.py new file mode 100644 index 0000000..bdb1c62 --- /dev/null +++ b/data-pipeline/bcreg/tests/bcreg_test_prod_corps.py @@ -0,0 +1,55 @@ + +import time + +from bcreg.bcregistries import BCRegistries, system_type +from bcreg.eventprocessor import EventProcessor +from bcreg.tests.sample_corps import sample_test_corps + + +def test_dev_corp_sql(): + specific_corps = [ +'1159443', + ] + + # try caching everything + #with BCRegistries(True) as bc_registries: + # bc_registries.cache_bcreg_corps(specific_corps) + +#def test_dev_corp_sql(): +# specific_corps = [ +# 'C1033288','C1043095' +# ] + + # go one-by-one + with BCRegistries(True) as bc_registries: + for corp in specific_corps: + #print('=========================') + print('===== ', corp) + bc_registries.cache_bcreg_corp_tables([corp], True) + sqls = bc_registries.generated_sqls + fake_corp_num = bc_registries.add_generated_corp_num(corp) + print('=============>>> ', fake_corp_num) + #print('=========================') + #print('sqls:') + #for sql in sqls: + # print('"""' + sql.replace(' values ', '\nvalues\n') + '""",') + #print('=========================') + + with BCRegistries(True) as cached_bc_reg: + cached_bc_reg.cache_bcreg_code_tables() + cached_bc_reg.insert_cache_sqls(sqls) + + # try running with dummy event id zero + corp_info = cached_bc_reg.get_bc_reg_corp_info(fake_corp_num, 0) + #print('-------------------------') + #print('corp_info:') + #print(corp_info) + #print('-------------------------') + + with EventProcessor() as event_processor: + corp_creds = event_processor.generate_credentials(system_type, 0, 0, fake_corp_num, corp_info) + #print('-------------------------') + #print('corp_creds:') + #print(corp_creds) + #print('-------------------------') + diff --git a/doc/BCReg-DBA-Data-Model.png b/doc/BCReg-DBA-Data-Model.png index f47847d93d849c400711bba058bc664e2fc50708..d167ad1836c5ed488bf5be3a310698f2f2341a9b 100644 GIT binary patch delta 61 zcmV-D0K)%`KBui T0z(MzDYtXn&SCkp;R39$B~BaG delta 61 zcmV-D0K)%`7YQf;R39$e`X#v diff --git a/doc/BCReg-Data-Model.png b/doc/BCReg-Data-Model.png index 6b042703b77a61a60e3281d36c4035e28728df06..6ba27bb7b0201f8110f49b3df8e6648e67c76ba6 100644 GIT binary patch delta 61 zcmV-D0K)&rl>^6>1CV_I-LZa30vum`^6>1CV_I?XiAJ0vvz)%HM_*92_%WurP|Ci^8MCOkNKJ@A^CcBwmx` T0zwG7^DCd{*k;?aE(4jza@rks diff --git a/doc/Event-Processor-Data-Model.png b/doc/Event-Processor-Data-Model.png index 008ec529aae7e9bbefb9206e2968c33498416e7c..3583a9242df75b0e698fc027537ec744ce965390 100644 GIT binary patch delta 60 zcmV-C0K@;ij{&`p0g!tE6R~`P0UW;jBtK>xFfD{HSo(F-W$n=rChrwBy8j}tw9k_o S0zn5pRzsV89vHJ?0$WA=MHoN; delta 60 zcmV-C0K@;ij{&`p0g!tE8nJwW0UZAPNq)>YU|I-Yu=MMu%i5zMOx`PMbpJ(OX?K$v S0zn50Rzh2gvIMhY0$W8u4jHom diff --git a/doc/Event-Processor.png b/doc/Event-Processor.png index fad8696287c66da486897dfd65d6d05ac4ea9053..f7d1cbc2cad984fe765da2ab72598547b73747e8 100644 GIT binary patch delta 64 zcmV-G0Kfm8_ynE!1dw|HCb4|g0vy#BdlU+Ak?+;XPqU=UjH4q-UUz%m^*4Lf|7w$M W140L5FUhC`t2KkR1GlyV0cSYdiybxq delta 64 zcmV-G0Kfm8_ynE!1dw|HG_icu0vy*b_9ztKBHyc%pJqvy8AnHwyzchA>u>g|e`S+x W140KdFUUXI4sCW