def test_display_lending_rates(mocker):
    # MOCK EXPORT_DATA
    mocker.patch(
        target=
        "gamestonk_terminal.cryptocurrency.defi.defirate_view.export_data")

    defirate_view.display_lending_rates(
        top=5,
        current=True,
        export="",
    )
Beispiel #2
0
    def call_lending(self, other_args: List[str]):
        """Process lending command"""
        parser = argparse.ArgumentParser(
            add_help=False,
            formatter_class=argparse.ArgumentDefaultsHelpFormatter,
            prog="lending",
            description="""
                 Display DeFi lending rates.
                 [Source: https://defirate.com/]
             """,
        )

        parser.add_argument(
            "-l",
            "--limit",
            dest="limit",
            type=check_positive,
            help="Number of records to display",
            default=15,
        )

        parser.add_argument(
            "--current",
            action="store_false",
            default=True,
            dest="current",
            help="Show Current Lending Rates or Last 30 Days Average",
        )

        ns_parser = parse_known_args_and_warn(parser, other_args,
                                              EXPORT_ONLY_RAW_DATA_ALLOWED)

        if ns_parser:
            defirate_view.display_lending_rates(top=ns_parser.limit,
                                                current=ns_parser.current,
                                                export=ns_parser.export)