From 668e8c26ad61b0ff1ee1beeb81d729934dd298f7 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sun, 19 Jun 2011 16:03:13 -0500 Subject: [PATCH] Reset the globals parameters while testing parameters (This way we can be sure that the database is torn down if necessary but this was the only test that passed last.) --- mediagoblin/tests/test_globals.py | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/mediagoblin/tests/test_globals.py b/mediagoblin/tests/test_globals.py index 59d217f3..1acea328 100644 --- a/mediagoblin/tests/test_globals.py +++ b/mediagoblin/tests/test_globals.py @@ -16,14 +16,23 @@ from mediagoblin import mg_globals -def test_setup_globals(): - mg_globals.setup_globals( - db_connection='my favorite db_connection!', - database='my favorite database!', - public_store='my favorite public_store!', - queue_store='my favorite queue_store!') - - assert mg_globals.db_connection == 'my favorite db_connection!' - assert mg_globals.database == 'my favorite database!' - assert mg_globals.public_store == 'my favorite public_store!' - assert mg_globals.queue_store == 'my favorite queue_store!' +class TestGlobals(object): + def setUp(self): + self.old_connection = mg_globals.db_connection + self.old_database = mg_globals.database + + def tearDown(self): + mg_globals.db_connection = self.old_connection + mg_globals.database = self.old_database + + def test_setup_globals(self): + mg_globals.setup_globals( + db_connection='my favorite db_connection!', + database='my favorite database!', + public_store='my favorite public_store!', + queue_store='my favorite queue_store!') + + assert mg_globals.db_connection == 'my favorite db_connection!' + assert mg_globals.database == 'my favorite database!' + assert mg_globals.public_store == 'my favorite public_store!' + assert mg_globals.queue_store == 'my favorite queue_store!' -- 2.25.1