From 0ffe5cd2fa87a23e5e35ad61b5c357df3ad44fd2 Mon Sep 17 00:00:00 2001 From: Alexander Morgan Date: Mon, 10 Oct 2016 19:47:25 -0400 Subject: [PATCH] Tests: Reactivate EDB connectivity tests that don't actually have to connect to EDB. --- run_tests.py | 2 +- vis/tests/test_indexed_piece.py | 37 +++++++++++++++++---------------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/run_tests.py b/run_tests.py index f2ac9ea6..6506a62d 100755 --- a/run_tests.py +++ b/run_tests.py @@ -99,7 +99,7 @@ test_aggregated_pieces.IMPORTER_SUITE, test_indexed_piece.INDEXED_PIECE_SUITE_A, test_indexed_piece.INDEXED_PIECE_PARTS_TITLES, -# test_indexed_piece.INDEXED_PIECE_SUITE_C, + test_indexed_piece.INDEXED_PIECE_SUITE_C, test_aggregated_pieces.AGGREGATED_PIECES_SUITE, # NB: Most of these WorkflowManager tests pass but they are commented out because the WorkflowManager is deprecated. # # WorkflowManager diff --git a/vis/tests/test_indexed_piece.py b/vis/tests/test_indexed_piece.py index a6f01958..020c1ef7 100755 --- a/vis/tests/test_indexed_piece.py +++ b/vis/tests/test_indexed_piece.py @@ -201,7 +201,7 @@ def test_part_ranges(self): expected_range = [('E4', 'E5'), ('E3', 'B4'), ('F#3', 'A4'), ('A2', 'C4')] actual_range = _find_part_ranges(score) self.assertEqual(expected_range, actual_range) -''' + class TestIndexedPieceC(TestCase): def test_meta(self): @@ -210,21 +210,22 @@ def test_meta(self): ind = IndexedPiece(piece, metafile=meta) self.assertEqual('Sacred', ind.metadata('religiosity')) - def test_json(self): - meta = 'http://database.elvisproject.ca/piece/1971/?format=json' - username = 'mborsodi' - password = 'lalalalala' - piece = os.path.join(VIS_PATH, 'tests', 'corpus', 'Missa-Fortuna-desperata_Kyrie_Josquin-Des-Prez_file6.xml') - ind = IndexedPiece(piece, metafile=meta, username=username, password=password) - self.assertEqual('Missa Fortuna desperata', ind.metadata('title')) - - def test_json2(self): - meta = 'http://database.elvisproject.ca/piece/1971/' - username = 'mborsodi' - password = 'lalalalala' - piece = os.path.join(VIS_PATH, 'tests', 'corpus', 'Missa-Fortuna-desperata_Kyrie_Josquin-Des-Prez_file6.xml') - ind = IndexedPiece(piece, metafile=meta, username=username, password=password) - self.assertEqual('Missa Fortuna desperata', ind.metadata('title')) + # These two tests are turned off until we can test without having to link to the ELVIS Database. + # def test_json(self): + # meta = 'http://database.elvisproject.ca/piece/1971/?format=json' + # username = 'mborsodi' + # password = 'lalalalala' + # piece = os.path.join(VIS_PATH, 'tests', 'corpus', 'Missa-Fortuna-desperata_Kyrie_Josquin-Des-Prez_file6.xml') + # ind = IndexedPiece(piece, metafile=meta, username=username, password=password) + # self.assertEqual('Missa Fortuna desperata', ind.metadata('title')) + + # def test_json2(self): + # meta = 'http://database.elvisproject.ca/piece/1971/' + # username = 'mborsodi' + # password = 'lalalalala' + # piece = os.path.join(VIS_PATH, 'tests', 'corpus', 'Missa-Fortuna-desperata_Kyrie_Josquin-Des-Prez_file6.xml') + # ind = IndexedPiece(piece, metafile=meta, username=username, password=password) + # self.assertEqual('Missa Fortuna desperata', ind.metadata('title')) def test_missing_usrn(self): meta = 'http://database.elvisproject.ca/piece/1971/' @@ -241,11 +242,11 @@ def test_missing_pswrd(self): IndexedPiece(piece, metafile=meta, username='mborsodi') except RuntimeError as run_err: self.assertEqual(IndexedPiece._MISSING_PASSWORD, run_err.args[0]) -''' + #-------------------------------------------------------------------------------------------------# # Definitions # #-------------------------------------------------------------------------------------------------# INDEXED_PIECE_SUITE_A = TestLoader().loadTestsFromTestCase(TestIndexedPieceA) INDEXED_PIECE_PARTS_TITLES = TestLoader().loadTestsFromTestCase(TestPartsAndTitles) -#INDEXED_PIECE_SUITE_C = TestLoader().loadTestsFromTestCase(TestIndexedPieceC) +INDEXED_PIECE_SUITE_C = TestLoader().loadTestsFromTestCase(TestIndexedPieceC)