def command_reconfig(parser, args) -> None: check_if_setup_is_needed() auth = utils.auth_from_config() utils.delete_user_data() if utils.are_credentials_valid(auth): utils.add_user_data_to_config(auth) utils.add_projects_to_config(auth) else: sys.exit( "\nCredentials error. Please run 'tgl setup' to reconfigure the credential data." )
def command_setup(parser, args) -> None: # If the defaults in the config.json file are not empty ask if to reconfigure if not utils.are_defaults_empty(): delete_data_input = input( "User data is not empty. Do you want to reconfigure it? (y/N) ") if delete_data_input.lower() == 'y': utils.delete_user_data() else: sys.exit("Data was not changed.") print( " Configuring your account. Account information will be saved in plain text on" ) print(f" a JSON file in {config_file_path}.\n") # Create authentication tuple either from email/password or API key if args.api: api_key = input( "Please enter your API token (found under 'Profile settings' in the Toggl website):\n" ) auth = (api_key, 'api_token') else: email = input("Please enter your email address: ") password = getpass("Please enter your password: "******"\nNothing entered, closing program.") # Check if the credentials are valid and then save the defaults to config.json if utils.are_credentials_valid(auth): utils.add_user_data_to_config(auth) utils.add_projects_to_config(auth) else: sys.exit("\nError: Incorrect credentials.") print("\nData saved.")
def setUp(self) -> None: delete_user_data() setup_credentials() return super().setUp()
def tearDown(self) -> None: tgl_stop() delete_user_data() return super().tearDown()
def tearDown(self) -> None: delete_project_with_name('project name for tests') delete_user_data() return super().tearDown()
def tearDown(self) -> None: delete_user_data() return super().tearDown()
def setUpClass(cls) -> None: delete_user_data() return super().setUpClass()
def tearDownClass(cls) -> None: delete_user_data() return super().tearDownClass()