def test_parse_for_empty_contents(self):
        start_date = datetime(2019, 4, 24)
        end_date = datetime(2019, 4, 24)

        url = ""

        rates = {}
        with patch.object(BCRALiborScraper,
                          'parse_day_content',
                          return_value={}):
            scraper = BCRALiborScraper(url, rates, False)
            contents = []
            parsed = scraper.parse_contents(contents, start_date, end_date)

            assert parsed == []
    def test_parse_for_non_empty_contents(self):
        start_date = datetime(2019, 4, 24)
        end_date = datetime(2019, 4, 24)

        url = "http://www.bcra.gov.ar/PublicacionesEstadisticas/libor.asp"

        rates = {
            "30": "libor_30_dias",
            "60": "libor_60_dias",
            "90": "libor_90_dias",
            "180": "libor_180_dias",
            "360": "libor_360_dias"
        }

        rows = {
            'indice_tiempo': '2019-03-15',
            '30': '2,481750',
            '60': '2,558380',
            '90': '2,625250',
            '180': '2,671750',
            '360': '2,840500'
        }

        with patch.object(BCRALiborScraper,
                          'parse_day_content',
                          return_value=rows):
            scraper = BCRALiborScraper(url,
                                       rates,
                                       intermediate_panel_path=None,
                                       use_intermediate_panel=False)

            contents = [{
                'indice_tiempo':
                start_date,
                'content':
                '''
            <table class="table table-BCRA table-bordered table-hover
                table-responsive">
            <thead>
                <tr>
                    <th colspan="2"
                    align="left">Tasa LIBOR al:  15/03/2019</th>
                </tr>
                <tr>
                    <th>Plazo en días</th>
                    <th>Tasa (T.N.A. %)</th>
                </tr>
            </thead>
            <tbody>
            <tr>
                <td>30</td>
                <td>2,481750</td>
            </tr>
            <tr>
                <td>60</td>
                <td>2,558380</td>
            </tr>
            <tr>
                <td>90</td>
                <td>2,625250</td>
            </tr>
            <tr>
                <td>180</td>
                <td>2,671750</td>
            </tr>
            <tr>
                <td>360</td>
                <td>2,840500</td>
            </tr>
            </tbody>
            </table>
            '''
            }]

            parsed = scraper.parse_contents(contents, start_date, end_date)

            assert parsed == [{
                'indice_tiempo': '2019-03-15',
                '30': '2,481750',
                '60': '2,558380',
                '90': '2,625250',
                '180': '2,671750',
                '360': '2,840500'
            }]