def test_get(self, client: FlaskClient): with client: result = client.get( f'{URL_PREFIX}{BASE_ROUTE}/IFIX/VGIP11').get_json() expected = make_theoretical_portifolio(index='IFIX', asset='VGIP11') assert result['indexSymbol'] == expected.index_symbol assert result['assetSymbol'] == expected.asset_symbol
def test_get(self, client: FlaskClient): with client: results = client.get(f'{URL_PREFIX}{BASE_ROUTE}', follow_redirects=True).get_json() expected = (ValuationIndicatorsSchema(many=True).dump([ make_valuation_indicator(123, symbol='Test symbol 1'), make_valuation_indicator(456, symbol='Test symbol 2'), ])) for r in results: assert r in expected
def test_get(self, client: FlaskClient): with client: results = client.get(f'{URL_PREFIX}{BASE_ROUTE}', follow_redirects=True).get_json() expected = (TheoreticalPortifolioSchema(many=True).dump([ make_theoretical_portifolio('IBOV', asset='PETR4'), make_theoretical_portifolio('IFIX', asset='RBRP11'), ])) for r in results: assert r in expected
def test_get(self, client: FlaskClient): with client: results = client.get(f'{URL_PREFIX}{BASE_ROUTE}', follow_redirects=True).get_json() expected = (CurrentPriceSchema(many=True).dump([ make_current_price(123, symbol='Test symbol 1'), make_current_price(456, symbol='Test symbol 2'), ])) for r in results: assert r in expected
def test_api_healthy(client): with client: response = client.get(f'{URL_PREFIX}/') assert response.status_code == 200
def test_get(self, client: FlaskClient): with client: result = client.get( f'{URL_PREFIX}{BASE_ROUTE}/TEST SYMBOL').get_json() expected = make_valuation_indicator(symbol='Test symbol') assert result['assetSymbol'] == expected.asset_symbol