mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Fix initialization-related tests for rethinkdb schema
This commit is contained in:
parent
32b6c50d63
commit
ccd8e74868
@ -15,13 +15,14 @@ def setup_database(request, node_config):
|
||||
|
||||
|
||||
def test_init_creates_db_tables_and_indexes():
|
||||
from bigchaindb.backend.schema import init_database
|
||||
conn = backend.connect()
|
||||
dbname = bigchaindb.config['database']['name']
|
||||
|
||||
# The db is set up by fixtures so we need to remove it
|
||||
conn.run(r.db_drop(dbname))
|
||||
|
||||
schema.create_database(conn, dbname)
|
||||
init_database()
|
||||
|
||||
assert conn.run(r.db_list().contains(dbname)) is True
|
||||
|
||||
@ -34,6 +35,20 @@ def test_init_creates_db_tables_and_indexes():
|
||||
'assignee__transaction_timestamp')) is True
|
||||
|
||||
|
||||
def test_init_database_fails_if_db_exists():
|
||||
from bigchaindb.backend.schema import init_database
|
||||
from bigchaindb.common import exceptions
|
||||
|
||||
conn = backend.connect()
|
||||
dbname = bigchaindb.config['database']['name']
|
||||
|
||||
# The db is set up by fixtures
|
||||
assert conn.run(r.db_list().contains(dbname)) is True
|
||||
|
||||
with pytest.raises(exceptions.DatabaseAlreadyExists):
|
||||
init_database()
|
||||
|
||||
|
||||
def test_create_database():
|
||||
conn = backend.connect()
|
||||
dbname = bigchaindb.config['database']['name']
|
||||
@ -91,19 +106,6 @@ def test_create_bigchain_secondary_index():
|
||||
'block_and_voter')) is True
|
||||
|
||||
|
||||
def test_init_database_fails_if_db_exists():
|
||||
from bigchaindb.common import exceptions
|
||||
|
||||
conn = backend.connect()
|
||||
dbname = bigchaindb.config['database']['name']
|
||||
|
||||
# The db is set up by fixtures
|
||||
assert conn.run(r.db_list().contains(dbname)) is True
|
||||
|
||||
with pytest.raises(exceptions.DatabaseAlreadyExists):
|
||||
schema.init_database()
|
||||
|
||||
|
||||
def test_drop():
|
||||
conn = backend.connect()
|
||||
dbname = bigchaindb.config['database']['name']
|
||||
|
Loading…
x
Reference in New Issue
Block a user