Skip to content
Snippets Groups Projects
Commit f3af9f85 authored by Pavel Kácha's avatar Pavel Kácha
Browse files

Merge branch 'warden-server-test-fix' into devel

parents a5b7634c 0bc605c4
No related branches found
No related tags found
No related merge requests found
...@@ -8,11 +8,15 @@ import sys ...@@ -8,11 +8,15 @@ import sys
import warnings import warnings
from os import path from os import path
from copy import deepcopy from copy import deepcopy
import unittest2 as unittest
import MySQLdb as my import MySQLdb as my
from warden_server import build_server from warden_server import build_server
import warden_server import warden_server
if sys.version_info >= (3, 10):
import unittest
else:
import unittest2 as unittest
if sys.version_info[0] >= 3: if sys.version_info[0] >= 3:
from io import StringIO from io import StringIO
else: else:
...@@ -408,8 +412,9 @@ def init_user(): ...@@ -408,8 +412,9 @@ def init_user():
conn = None conn = None
try: try:
conn = my.connect(user='root', passwd=getpass.getpass('Enter MySQL Root password:')) conn = my.connect(user='root', passwd=getpass.getpass('Enter MySQL Root password:'))
with conn as cur: # Not a canonical connector implementation, for sure with conn.cursor() as cur:
cur.execute("GRANT SELECT, INSERT, UPDATE, CREATE, DELETE, DROP ON *.* TO %s@'localhost' IDENTIFIED BY %s", (USER, PASSWORD)) cur.execute("CREATE USER IF NOT EXISTS %s@'localhost' IDENTIFIED BY %s", (USER, PASSWORD))
cur.execute("GRANT SELECT, INSERT, UPDATE, CREATE, DELETE, DROP ON *.* TO %s@'localhost'", (USER,))
conn.commit() conn.commit()
print("DB User set up successfuly") print("DB User set up successfuly")
except my.OperationalError as ex: except my.OperationalError as ex:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment