Esempio n. 1
0
def test_validate_auth_invalid():
    d = Deleter("a", "b", "c", "d", None, None, 5, False)
    with pytest.raises(twitter.error.TwitterError):
        d.validate_creds()
Esempio n. 2
0
def cli(
    consumer_key,
    consumer_secret,
    access_token_key,
    access_token_secret,
    delete_older_than,
    delete_everything_after,
    minimum_engagement,
    remove_favorites,
):
    """A simple program to delete all your tweets! Woohoo!"""
    from tweet_delete.deleter import Deleter
    from tweet_delete.util import td_format

    click.echo(click.style("🐦␑ starting tweet-delete".ljust(76) + "␑🐦", fg="green"))
    deleter = Deleter(
        consumer_key,
        consumer_secret,
        access_token_key,
        access_token_secret,
        delete_older_than,
        delete_everything_after,
        minimum_engagement,
        remove_favorites,
    )
    click.echo(click.style("πŸ”‘ validating credentials".ljust(77) + "πŸ”‘", fg="yellow"))
    creds = deleter.validate_creds()
    click.echo(
        highlight(
            json.dumps(creds.AsDict(), sort_keys=True, indent=2),
            JsonLexer(),
            TerminalFormatter(),
        )
    )
    click.echo(
        click.style(
            "πŸ‘‰ tweets older than {} will be deleted".format(
                td_format(delete_older_than.total_seconds())
            ).ljust(77)
            + "πŸ‘ˆ",
            fg="yellow",
        )
    )
    if delete_everything_after is not None:
        click.echo(
            click.style(
                "πŸ‘‰ only tweets created after {} will be deleted".format(
                    str(delete_everything_after)
                ).ljust(77)
                + "πŸ‘ˆ",
                fg="yellow",
            )
        )
    if remove_favorites:
        click.echo(
            click.style(
                "πŸ‘‰ deleting favorites older than {} created after {}".format(
                    td_format(delete_older_than.total_seconds()),
                    str(delete_everything_after),
                ).ljust(77)
                + "πŸ‘ˆ",
                fg="yellow",
            )
        )
    else:
        click.echo(
            click.style("πŸ‘‰ favorites will NOT be deleted".ljust(77) + "πŸ‘ˆ", fg="yellow",)
        )
    click.echo(click.style("πŸ¦… off we go".ljust(77) + "πŸ¦…", fg="green"))
    deleter.run()
Esempio n. 3
0
def test_validate_auth_invalid():
    d = Deleter('a', 'b', 'c', 'd', None, None, 5)
    with pytest.raises(twitter.error.TwitterError):
        d.validate_creds()