mirror of https://gitlab.com/litecord/litecord.git
remove manage.cmd.tests
This commit is contained in:
parent
cde6bc8ed8
commit
103d88d8f8
|
|
@ -1,54 +0,0 @@
|
|||
"""
|
||||
|
||||
Litecord
|
||||
Copyright (C) 2018-2019 Luna Mendes
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, version 3 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
|
||||
from tests.credentials import CREDS
|
||||
from litecord.blueprints.auth import create_user
|
||||
from manage.cmd.users import set_user_staff
|
||||
|
||||
|
||||
async def setup_tests(ctx, _args):
|
||||
"""Setup users for the testing environment."""
|
||||
for name, creds in CREDS.items():
|
||||
uid, _ = await create_user(
|
||||
creds['username'],
|
||||
creds['email'],
|
||||
creds['password'],
|
||||
ctx.db,
|
||||
ctx.loop
|
||||
)
|
||||
|
||||
discrim = await ctx.db.fetchval("""
|
||||
SELECT discriminator FROM users WHERE id = $1
|
||||
""", uid)
|
||||
|
||||
print(f'created {name} {discrim} user: {uid}')
|
||||
|
||||
if name == 'admin':
|
||||
await set_user_staff(uid, ctx)
|
||||
|
||||
print('OK')
|
||||
|
||||
|
||||
def setup(subparser):
|
||||
setup_test_parser = subparser.add_parser(
|
||||
'setup_tests',
|
||||
help='Create test users',
|
||||
)
|
||||
|
||||
setup_test_parser.set_defaults(func=setup_tests)
|
||||
|
|
@ -26,7 +26,7 @@ from logbook import Logger
|
|||
|
||||
from run import init_app_managers, init_app_db
|
||||
from manage.cmd.migration import migration
|
||||
from manage.cmd import users, tests, invites
|
||||
from manage.cmd import users, invites
|
||||
|
||||
log = Logger(__name__)
|
||||
|
||||
|
|
@ -54,7 +54,6 @@ def init_parser():
|
|||
|
||||
migration(subparser)
|
||||
users.setup(subparser)
|
||||
tests.setup(subparser)
|
||||
invites.setup(subparser)
|
||||
|
||||
return parser
|
||||
|
|
|
|||
Loading…
Reference in New Issue