File tree Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change 1- from api_to_dataframe .controller import client_builder as ClientBuilder
2- from api_to_dataframe .common .utils import retry_strategies as RetryStrategies
1+ from api_to_dataframe .controller . client_builder import ClientBuilder
2+ from api_to_dataframe .common .utils . retry_strategies import RetryStrategies
Original file line number Diff line number Diff line change 11import pytest
22import pandas as pd
3- import api_to_dataframe as api_to_dataframe
3+ from api_to_dataframe import ClientBuilder
44
55
66@pytest .fixture ()
77def setup ():
8- new_client = api_to_dataframe . ClientBuilder (endpoint = "https://economia.awesomeapi.com.br/last/USD-BRL" )
8+ new_client = ClientBuilder (endpoint = "https://economia.awesomeapi.com.br/last/USD-BRL" )
99 return new_client
1010
1111
12+ @pytest .fixture ()
13+ def response_setup ():
14+ new_client = ClientBuilder (endpoint = "https://economia.awesomeapi.com.br/last/USD-BRL" )
15+ return new_client .get_api_data ()
16+
17+
1218def test_constructor_without_param ():
1319 with pytest .raises (ValueError ):
14- new_client = api_to_dataframe . ClientBuilder (endpoint = "" )
20+ new_client = ClientBuilder (endpoint = "" )
1521
1622
1723def test_constructor_with_param (setup ):
@@ -22,11 +28,10 @@ def test_constructor_with_param(setup):
2228
2329def test_response_to_json (setup ):
2430 new_client = setup
25- response = new_client ._response_to_json ()
31+ response = new_client .get_api_data ()
2632 assert isinstance (response , dict )
2733
2834
29- def test_to_dataframe (setup ):
30- new_client = setup
31- df = new_client .to_dataframe ()
35+ def test_to_dataframe (response_setup ):
36+ df = ClientBuilder .api_to_dataframe (response_setup )
3237 assert isinstance (df , pd .DataFrame )
You can’t perform that action at this time.
0 commit comments