add input in snapshot command for select user

This commit is contained in:
Cayo Puigdefabregas 2023-07-25 09:49:29 +02:00
parent 7f449aa95c
commit 0d2dd2fcb1
1 changed files with 6 additions and 4 deletions

View File

@ -9,7 +9,7 @@ from os import remove as remove_file
from os.path import isfile, join from os.path import isfile, join
from pathlib import Path from pathlib import Path
from decouple import config import click
from flask.testing import FlaskClient from flask.testing import FlaskClient
from flask_wtf.csrf import generate_csrf from flask_wtf.csrf import generate_csrf
@ -32,8 +32,12 @@ class UploadSnapshots:
self.schema = app.config.get('DB_SCHEMA') self.schema = app.config.get('DB_SCHEMA')
self.app.cli.command('snapshot', short_help='Upload snapshots.')(self.run) self.app.cli.command('snapshot', short_help='Upload snapshots.')(self.run)
def run(self): @click.argument('email')
@click.argument('password')
def run(self, email, password=None):
"""Run command.""" """Run command."""
self.email = email
self.password = password
self.json_wb = None self.json_wb = None
self.onlyfiles = [] self.onlyfiles = []
@ -48,8 +52,6 @@ class UploadSnapshots:
def get_user(self): def get_user(self):
"""Get datamodel of user.""" """Get datamodel of user."""
self.email = config('EMAIL_DEMO')
self.password = config('PASSWORD_DEMO')
self.user = User.query.filter_by(email=self.email).one() self.user = User.query.filter_by(email=self.email).one()
self.client = FlaskClient(self.app, use_cookies=True) self.client = FlaskClient(self.app, use_cookies=True)
self.client.get('/login/') self.client.get('/login/')