diff --git a/src/io/get_last_ref_date.py b/src/io/get_last_ref_date.py index 75d06b5..1890a77 100644 --- a/src/io/get_last_ref_date.py +++ b/src/io/get_last_ref_date.py @@ -23,7 +23,7 @@ def main(): table = soup.find('table') rows = table.find_all('tr') list_last_modified_at = [] - + breakpoint() print('creating dict files url') for row in rows: if row.find_all('td'): diff --git a/tests/io/htmls/test_get_last_ref_date.html b/tests/io/htmls/test_get_last_ref_date.html new file mode 100644 index 0000000..375a5e5 --- /dev/null +++ b/tests/io/htmls/test_get_last_ref_date.html @@ -0,0 +1,21 @@ + + + + +Index of /CNPJ/dados_abertos_cnpj + + +

Index of /CNPJ/dados_abertos_cnpj

+ + + + + + + + + + + +
[ICO]NameLast modifiedSizeDescription

[PARENTDIR]Parent Directory   -  
[DIR]2024-05/ 2024-08-20 14:23 -  
[DIR]2024-06/ 2024-08-16 09:58 -  
[DIR]2024-07/ 2024-08-15 15:32 -  
[DIR]2024-08/ 2024-08-14 11:42 -  
[DIR]2024-09/ 2024-09-18 16:20 -  
[DIR]2024-10/ 2024-10-16 09:16 -  

+ diff --git a/tests/io/htmls/test_get_last_ref_date_all_equal.html b/tests/io/htmls/test_get_last_ref_date_all_equal.html deleted file mode 100644 index 8f485a6..0000000 --- a/tests/io/htmls/test_get_last_ref_date_all_equal.html +++ /dev/null @@ -1,53 +0,0 @@ - - - - Index of /CNPJ - - -

Index of /CNPJ

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[ICO]NameLast modifiedSizeDescription

[PARENTDIR]Parent Directory   -  
[   ]Cnaes.zip 2022-08-15 14:01 22K 
[   ]Empresas0.zip 2022-08-15 14:49 198M 
[   ]Empresas1.zip 2022-08-15 14:53 74M 
[   ]Empresas2.zip 2022-08-15 14:50 75M 
[   ]Empresas3.zip 2022-08-15 14:50 81M 
[   ]Empresas4.zip 2022-08-15 14:51 86M 
[   ]Empresas5.zip 2022-08-15 14:51 93M 
[   ]Empresas6.zip 2022-08-15 14:52 91M 
[   ]Empresas7.zip 2022-08-15 14:53 95M 
[   ]Empresas8.zip 2022-08-15 14:48 96M 
[   ]Empresas9.zip 2022-08-15 14:49 91M 
[   ]Estabelecimentos0.zip 2022-08-15 14:26 758M 
[   ]Estabelecimentos1.zip 2022-08-15 14:46 327M 
[   ]Estabelecimentos2.zip 2022-08-15 14:44 329M 
[   ]Estabelecimentos3.zip 2022-08-15 14:45 326M 
[   ]Estabelecimentos4.zip 2022-08-15 14:33 327M 
[   ]Estabelecimentos5.zip 2022-08-15 14:37 329M 
[   ]Estabelecimentos6.zip 2022-08-15 14:40 329M 
[   ]Estabelecimentos7.zip 2022-08-15 14:30 337M 
[   ]Estabelecimentos8.zip 2022-08-15 14:17 341M 
[   ]Estabelecimentos9.zip 2022-08-15 14:24 335M 
[   ]LAYOUT_DADOS_ABERTOS..>2019-02-22 17:41 115K 
[   ]Motivos.zip 2022-08-15 14:01 1.1K 
[   ]Municipios.zip 2022-08-15 14:01 42K 
[   ]Naturezas.zip 2022-08-15 14:01 1.5K 
[   ]Paises.zip 2022-08-15 14:01 2.7K 
[   ]Qualificacoes.zip 2022-08-15 14:01 1.0K 
[   ]Simples.zip 2022-08-15 14:02 173M 
[   ]Socios0.zip 2022-08-15 14:07 86M 
[   ]Socios1.zip 2022-08-15 14:06 47M 
[   ]Socios2.zip 2022-08-15 14:06 47M 
[   ]Socios3.zip 2022-08-15 14:08 47M 
[   ]Socios4.zip 2022-08-15 14:08 47M 
[   ]Socios5.zip 2022-08-15 14:08 47M 
[   ]Socios6.zip 2022-08-15 14:08 47M 
[   ]Socios7.zip 2022-08-15 14:09 47M 
[   ]Socios8.zip 2022-08-15 14:09 47M 
[   ]Socios9.zip 2022-08-15 14:06 47M 
[DIR]anual/ 2021-12-07 19:11 -  

- diff --git a/tests/io/htmls/test_get_last_ref_date_diffs.html b/tests/io/htmls/test_get_last_ref_date_diffs.html deleted file mode 100644 index 053c85c..0000000 --- a/tests/io/htmls/test_get_last_ref_date_diffs.html +++ /dev/null @@ -1,53 +0,0 @@ - - - - Index of /CNPJ - - -

Index of /CNPJ

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[ICO]NameLast modifiedSizeDescription

[PARENTDIR]Parent Directory   -  
[   ]Cnaes.zip 2020-01-01 14:01 22K 
[   ]Empresas0.zip 2020-01-01 14:49 198M 
[   ]Empresas1.zip 2020-01-01 14:53 74M 
[   ]Empresas2.zip 2020-01-01 14:50 75M 
[   ]Empresas3.zip 2020-01-01 14:50 81M 
[   ]Empresas4.zip 2020-01-01 14:51 86M 
[   ]Empresas5.zip 2020-01-01 14:51 93M 
[   ]Empresas6.zip 2020-01-01 14:52 91M 
[   ]Empresas7.zip 2020-01-01 14:53 95M 
[   ]Empresas8.zip 2020-01-01 14:48 96M 
[   ]Empresas9.zip 2020-01-01 14:49 91M 
[   ]Estabelecimentos0.zip 2020-01-01 14:26 758M 
[   ]Estabelecimentos1.zip 2020-01-01 14:46 327M 
[   ]Estabelecimentos2.zip 2020-01-01 14:44 329M 
[   ]Estabelecimentos3.zip 2020-01-01 14:45 326M 
[   ]Estabelecimentos4.zip 2020-01-01 14:33 327M 
[   ]Estabelecimentos5.zip 2020-01-01 14:37 329M 
[   ]Estabelecimentos6.zip 2020-01-01 14:40 329M 
[   ]Estabelecimentos7.zip 2020-01-01 14:30 337M 
[   ]Estabelecimentos8.zip 2020-01-01 14:17 341M 
[   ]Estabelecimentos9.zip 2020-01-01 14:24 335M 
[   ]LAYOUT_DADOS_ABERTOS..>2019-02-22 17:41 115K 
[   ]Motivos.zip 2022-08-15 14:01 1.1K 
[   ]Municipios.zip 2022-08-15 14:01 42K 
[   ]Naturezas.zip 2022-08-15 14:01 1.5K 
[   ]Paises.zip 2022-08-15 14:01 2.7K 
[   ]Qualificacoes.zip 2022-08-15 14:01 1.0K 
[   ]Simples.zip 2022-08-15 14:02 173M 
[   ]Socios0.zip 2022-08-15 14:07 86M 
[   ]Socios1.zip 2022-08-15 14:06 47M 
[   ]Socios2.zip 2022-08-15 14:06 47M 
[   ]Socios3.zip 2022-08-15 14:08 47M 
[   ]Socios4.zip 2022-08-15 14:08 47M 
[   ]Socios5.zip 2022-08-15 14:08 47M 
[   ]Socios6.zip 2022-08-15 14:08 47M 
[   ]Socios7.zip 2022-08-15 14:09 47M 
[   ]Socios8.zip 2022-08-15 14:09 47M 
[   ]Socios9.zip 2022-08-15 14:06 47M 
[DIR]anual/ 2021-12-07 19:11 -  

- diff --git a/tests/io/test_get_last_ref_date.py b/tests/io/test_get_last_ref_date.py index 707e1aa..1db5b96 100644 --- a/tests/io/test_get_last_ref_date.py +++ b/tests/io/test_get_last_ref_date.py @@ -16,27 +16,14 @@ def text(self): return self.txt -def test_get_last_ref_date_all_one_date(mocker): +def test_get_last_ref_date(mocker): mock_requests = Mock() mocker.patch('src.io.get_last_ref_date.requests', mock_requests) - html_file = 'test_get_last_ref_date_all_equal.html' + html_file = 'test_get_last_ref_date.html' html_path = os.path.join(DIR_NAME, 'htmls', html_file) mock_requests.get.return_value = ObjectFakeText(open(html_path)) ref_date = get_last_ref_date() - ref_date_expected = '2022-08-15' - - assert ref_date == ref_date_expected - - -def test_get_last_ref_date_diff_dates(mocker): - mock_requests = Mock() - mocker.patch('src.io.get_last_ref_date.requests', mock_requests) - html_file = 'test_get_last_ref_date_diffs.html' - html_path = os.path.join(DIR_NAME, 'htmls', html_file) - mock_requests.get.return_value = ObjectFakeText(open(html_path)) - - ref_date = get_last_ref_date() - ref_date_expected = '2020-01-01' + ref_date_expected = '2024-10' assert ref_date == ref_date_expected