Commit 508be503 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Bootstrap tests use SQL test user without password and log level set to ERROR.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@374 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 9203c883
......@@ -35,13 +35,12 @@ from neo.protocol import ANSWER_PRIMARY_MASTER
SQL_ADMIN_USER = 'root'
SQL_ADMIN_PASSWORD = None
NEO_SQL_USER = 'test'
NEO_SQL_PASSWORD = 'test'
NEO_SQL_DATABASE = 'test_neo1'
class StorageBootstrapTests(unittest.TestCase):
def setUp(self):
#logging.basicConfig(level = logging.DEBUG)
logging.basicConfig(level = logging.ERROR)
# create an application object
config_file_text = """# Default parameters.
[DEFAULT]
......@@ -55,8 +54,6 @@ partitions: 1009
name: main
# The user name for the database.
user: %(user)s
# The password for the database.
password: %(password)s
connector : SocketConnector
# The first master.
[mastertest]
......@@ -68,7 +65,6 @@ server: 127.0.0.1:10020
""" % {
'database': NEO_SQL_DATABASE,
'user': NEO_SQL_USER,
'password': NEO_SQL_PASSWORD,
}
# SQL connection
connect_arg_dict = {'user': SQL_ADMIN_USER}
......@@ -79,8 +75,8 @@ server: 127.0.0.1:10020
# new database
cursor.execute('DROP DATABASE IF EXISTS %s' % (NEO_SQL_DATABASE, ))
cursor.execute('CREATE DATABASE %s' % (NEO_SQL_DATABASE, ))
cursor.execute('GRANT ALL ON %s.* TO "%s"@"localhost" IDENTIFIED BY "%s"' %
(NEO_SQL_DATABASE, NEO_SQL_USER, NEO_SQL_PASSWORD))
cursor.execute('GRANT ALL ON %s.* TO "%s"@"localhost" IDENTIFIED BY ""' %
(NEO_SQL_DATABASE, NEO_SQL_USER))
cursor.close()
# config file
tmp_id, self.tmp_path = mkstemp()
......
......@@ -27,13 +27,11 @@ from neo.storage.mysqldb import MySQLDatabaseManager, p64, u64
SQL_ADMIN_USER = 'root'
SQL_ADMIN_PASSWORD = None
NEO_SQL_USER = 'test'
NEO_SQL_PASSWORD = 'test'
NEO_SQL_DATABASE = 'test_neo1'
class StorageMySQSLdbTests(unittest.TestCase):
def setUp(self):
#logging.basicConfig(level = logging.DEBUG)
logging.basicConfig(level = logging.ERROR)
# SQL connection
connect_arg_dict = {'user': SQL_ADMIN_USER}
......@@ -44,13 +42,12 @@ class StorageMySQSLdbTests(unittest.TestCase):
# new database
cursor.execute('DROP DATABASE IF EXISTS %s' % (NEO_SQL_DATABASE, ))
cursor.execute('CREATE DATABASE %s' % (NEO_SQL_DATABASE, ))
cursor.execute('GRANT ALL ON %s.* TO "%s"@"localhost" IDENTIFIED BY "%s"' %
(NEO_SQL_DATABASE, NEO_SQL_USER, NEO_SQL_PASSWORD))
cursor.execute('GRANT ALL ON %s.* TO "%s"@"localhost" IDENTIFIED BY ""' %
(NEO_SQL_DATABASE, NEO_SQL_USER))
# db manager
self.db = MySQLDatabaseManager(
database=NEO_SQL_DATABASE,
user=NEO_SQL_USER,
password=NEO_SQL_PASSWORD,
)
def tearDown(self):
......@@ -73,12 +70,10 @@ class StorageMySQSLdbTests(unittest.TestCase):
db = MySQLDatabaseManager(
database=NEO_SQL_DATABASE,
user=NEO_SQL_USER,
password=NEO_SQL_PASSWORD,
)
# init
self.assertEquals(db.db, NEO_SQL_DATABASE)
self.assertEquals(db.user, NEO_SQL_USER)
self.assertEquals(db.passwd, NEO_SQL_PASSWORD)
# & connect
import MySQLdb
self.assertTrue(isinstance(db.conn, MySQLdb.connection))
......
......@@ -32,7 +32,6 @@ from neo.protocol import *
SQL_ADMIN_USER = 'root'
SQL_ADMIN_PASSWORD = None
NEO_SQL_USER = 'test'
NEO_SQL_PASSWORD = 'test'
NEO_SQL_DATABASE = 'test_neo1'
class StorageOperationTests(unittest.TestCase):
......@@ -84,7 +83,6 @@ class StorageOperationTests(unittest.TestCase):
self.assertEquals(len(conn.mockGetNamedCalls('addPacket')), 0)
def setUp(self):
#logging.basicConfig(level = logging.DEBUG)
logging.basicConfig(level = logging.ERROR)
# create an application object
config_file_text = """# Default parameters.
......@@ -99,8 +97,6 @@ partitions: 1009
name: main
# The user name for the database.
user: %(user)s
# The password for the database.
password: %(password)s
connector : SocketConnector
# The first master.
[mastertest]
......@@ -112,7 +108,6 @@ server: 127.0.0.1:10020
""" % {
'database': NEO_SQL_DATABASE,
'user': NEO_SQL_USER,
'password': NEO_SQL_PASSWORD,
}
# SQL connection
connect_arg_dict = {'user': SQL_ADMIN_USER}
......@@ -123,8 +118,8 @@ server: 127.0.0.1:10020
# new database
cursor.execute('DROP DATABASE IF EXISTS %s' % (NEO_SQL_DATABASE, ))
cursor.execute('CREATE DATABASE %s' % (NEO_SQL_DATABASE, ))
cursor.execute('GRANT ALL ON %s.* TO "%s"@"localhost" IDENTIFIED BY "%s"' %
(NEO_SQL_DATABASE, NEO_SQL_USER, NEO_SQL_PASSWORD))
cursor.execute('GRANT ALL ON %s.* TO "%s"@"localhost" IDENTIFIED BY ""' %
(NEO_SQL_DATABASE, NEO_SQL_USER))
# config file
tmp_id, self.tmp_path = mkstemp()
tmp_file = os.fdopen(tmp_id, "w+b")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment