def test_version(mock_github_response, capfd): ephemetoot.version("TEST_VERSION") output = capfd.readouterr().out msg = """ ephemetoot ==> 🥳 ==> 🧼 ==> 😇 ------------------------------- You are using release: \033[92mvTEST_VERSION\033[0m The latest release is: \033[92mvLATEST_VERSION\033[0m To upgrade to the most recent version run \033[92mpip install --upgrade ephemetoot\033[0m\n""" assert output == msg
def main(): """ Call ephemetoot.check_toots() on each user in the config file, with options set via flags from command line. """ try: if options.init: func.init() elif options.version: func.version(vnum) elif options.schedule: func.schedule(options) else: if not options.quiet: print("") print("============= EPHEMETOOT v" + vnum + " ================") print("Running at " + str( datetime.now(timezone.utc).strftime( "%a %d %b %Y %H:%M:%S %z"))) print("================================================") print("") if options.test: print("This is a test run...\n") with open(config_file) as config: for accounts in yaml.safe_load_all(config): for user in accounts: func.check_toots(user, options) except FileNotFoundError as err: if err.filename == config_file: print("🕵️ Missing config file") print("Run \033[92mephemetoot --init\033[0m to create a new one\n") else: print( "\n🤷♂️ The archive directory in your config file does not exist" ) print( "Create the directory or correct your config before trying again\n" )