Skip to content
Snippets Groups Projects
Commit 9a4b5879 authored by Colton Leekley-Winslow's avatar Colton Leekley-Winslow Committed by GitHub
Browse files

Merge pull request #594 from scitran/run_db_test

run db test
parents 1fd49333 d6999ee4
No related branches found
No related tags found
No related merge requests found
import pytest
import os.path
import sys
from mock import Mock, patch
import pytest
bin_path = os.path.join(os.getcwd(), "bin")
sys.path.insert(0, bin_path)
import database
from bin import database
from api import config
CDV = database.CURRENT_DATABASE_VERSION
......@@ -29,7 +34,7 @@ def database_mock_setup():
script_name = 'upgrade_to_{}'.format(i)
setattr(database, script_name, Mock())
@patch('bin.database.get_db_version', Mock(return_value=0))
@patch('database.get_db_version', Mock(return_value=0))
def test_all_upgrade_scripts_ran(database_mock_setup):
with pytest.raises(SystemExit):
database.upgrade_schema()
......@@ -37,7 +42,7 @@ def test_all_upgrade_scripts_ran(database_mock_setup):
script_name = 'upgrade_to_{}'.format(i)
assert getattr(database, script_name).called
@patch('bin.database.get_db_version', Mock(return_value=CDV-4))
@patch('database.get_db_version', Mock(return_value=CDV-4))
def test_necessary_upgrade_scripts_ran(database_mock_setup):
with pytest.raises(SystemExit):
database.upgrade_schema()
......
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