From df9809c2098d18b0272c40154b5e40d67b703214 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sun, 24 Apr 2011 14:48:55 -0500 Subject: Make certain bits of info accessable as global variables from anywhere --- mediagoblin/tests/test_globals.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 mediagoblin/tests/test_globals.py (limited to 'mediagoblin/tests/test_globals.py') diff --git a/mediagoblin/tests/test_globals.py b/mediagoblin/tests/test_globals.py new file mode 100644 index 00000000..6d2e01da --- /dev/null +++ b/mediagoblin/tests/test_globals.py @@ -0,0 +1,29 @@ +# GNU MediaGoblin -- federated, autonomous media hosting +# Copyright (C) 2011 Free Software Foundation, Inc +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +from mediagoblin import globals as 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!' -- cgit v1.2.3 From 49285baf2755e4cead741dd5c615a65736a5dc08 Mon Sep 17 00:00:00 2001 From: Elrond Date: Sun, 12 Jun 2011 17:36:49 +0200 Subject: Let setup_globals check for known globals To avoid typos in calling setup_globals(), only allow globals, which are already known to the system. Plugins should have their own globals. --- mediagoblin/tests/test_globals.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'mediagoblin/tests/test_globals.py') diff --git a/mediagoblin/tests/test_globals.py b/mediagoblin/tests/test_globals.py index 6d2e01da..b285cdf5 100644 --- a/mediagoblin/tests/test_globals.py +++ b/mediagoblin/tests/test_globals.py @@ -14,6 +14,8 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from nose.tools import assert_raises + from mediagoblin import globals as mg_globals def test_setup_globals(): @@ -27,3 +29,8 @@ def test_setup_globals(): 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!' + + assert_raises( + AssertionError, + mg_globals.setup_globals, + no_such_global_foo = "Dummy") -- cgit v1.2.3 From 6e7ce8d1af8c6fcf7d00992b1c8ef0e8c1602479 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sun, 12 Jun 2011 17:27:37 -0500 Subject: mediagoblin.globals->mediagoblin.mg_globals --- mediagoblin/tests/test_globals.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mediagoblin/tests/test_globals.py') diff --git a/mediagoblin/tests/test_globals.py b/mediagoblin/tests/test_globals.py index 6d2e01da..59d217f3 100644 --- a/mediagoblin/tests/test_globals.py +++ b/mediagoblin/tests/test_globals.py @@ -14,7 +14,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -from mediagoblin import globals as mg_globals +from mediagoblin import mg_globals def test_setup_globals(): mg_globals.setup_globals( -- cgit v1.2.3 From 668e8c26ad61b0ff1ee1beeb81d729934dd298f7 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sun, 19 Jun 2011 16:03:13 -0500 Subject: 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(-) (limited to 'mediagoblin/tests/test_globals.py') 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!' -- cgit v1.2.3 From 12a100e4d8bdda7bd2353403a7e08e3a94669498 Mon Sep 17 00:00:00 2001 From: Will Kahn-Greene Date: Thu, 1 Sep 2011 20:49:54 -0400 Subject: 508. Updates copyright/license information --- mediagoblin/tests/test_globals.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mediagoblin/tests/test_globals.py') diff --git a/mediagoblin/tests/test_globals.py b/mediagoblin/tests/test_globals.py index 63578d62..84f1c74a 100644 --- a/mediagoblin/tests/test_globals.py +++ b/mediagoblin/tests/test_globals.py @@ -1,5 +1,5 @@ # GNU MediaGoblin -- federated, autonomous media hosting -# Copyright (C) 2011 Free Software Foundation, Inc +# Copyright (C) 2011 MediaGoblin contributors. See AUTHORS. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by -- cgit v1.2.3 From cf29e8a824e0ef4612f1144f079c80c1d20b89e5 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Thu, 2 Feb 2012 09:44:13 -0600 Subject: It's 2012 all up in here --- mediagoblin/tests/test_globals.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mediagoblin/tests/test_globals.py') diff --git a/mediagoblin/tests/test_globals.py b/mediagoblin/tests/test_globals.py index 84f1c74a..98f6a436 100644 --- a/mediagoblin/tests/test_globals.py +++ b/mediagoblin/tests/test_globals.py @@ -1,5 +1,5 @@ # GNU MediaGoblin -- federated, autonomous media hosting -# Copyright (C) 2011 MediaGoblin contributors. See AUTHORS. +# Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by -- cgit v1.2.3 From bc142abc5592975c08319416d0af12c108504887 Mon Sep 17 00:00:00 2001 From: Sebastian Spaeth Date: Thu, 29 Nov 2012 17:23:28 +0100 Subject: RIP out mongo Since sqlalchemy is providing our database abstraction and we have moved away from Mongo as the underlying database, it is now time to simplify things and rip out mongo. This provides the bulk of the changes, and can stand on its own. There are some followup tasks that can be done, such as removing now unneeded abstraction layers, e.g. db.sql.fake.py --- mediagoblin/tests/test_globals.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'mediagoblin/tests/test_globals.py') diff --git a/mediagoblin/tests/test_globals.py b/mediagoblin/tests/test_globals.py index 98f6a436..303f89e2 100644 --- a/mediagoblin/tests/test_globals.py +++ b/mediagoblin/tests/test_globals.py @@ -18,23 +18,20 @@ from nose.tools import assert_raises from mediagoblin import mg_globals + 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!' -- cgit v1.2.3 From 958080be1673bc654adad03abc93a2d7d05c1386 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Wed, 3 Apr 2013 14:05:42 -0500 Subject: All mediagoblin tests now pass with py.test (switched setUp to setup) --- mediagoblin/tests/test_globals.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mediagoblin/tests/test_globals.py') diff --git a/mediagoblin/tests/test_globals.py b/mediagoblin/tests/test_globals.py index 303f89e2..d3722140 100644 --- a/mediagoblin/tests/test_globals.py +++ b/mediagoblin/tests/test_globals.py @@ -20,10 +20,10 @@ from mediagoblin import mg_globals class TestGlobals(object): - def setUp(self): + def setup(self): self.old_database = mg_globals.database - def tearDown(self): + def teardown(self): mg_globals.database = self.old_database def test_setup_globals(self): -- cgit v1.2.3 From 7d503a897bddfadcd98d278bdb648503485a19de Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sat, 6 Apr 2013 10:07:47 -0500 Subject: Really removing nosetests things now! all assert_whatever removed --- mediagoblin/tests/test_globals.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'mediagoblin/tests/test_globals.py') diff --git a/mediagoblin/tests/test_globals.py b/mediagoblin/tests/test_globals.py index d3722140..fe3088f8 100644 --- a/mediagoblin/tests/test_globals.py +++ b/mediagoblin/tests/test_globals.py @@ -14,7 +14,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -from nose.tools import assert_raises +import pytest from mediagoblin import mg_globals @@ -36,7 +36,7 @@ class TestGlobals(object): assert mg_globals.public_store == 'my favorite public_store!' assert mg_globals.queue_store == 'my favorite queue_store!' - assert_raises( + pytest.raises( AssertionError, mg_globals.setup_globals, - no_such_global_foo = "Dummy") + no_such_global_foo="Dummy") -- cgit v1.2.3 From 0536306048daa0970d2e43411ba2a9bf073e570e Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Thu, 16 May 2013 17:51:21 -0500 Subject: Always activate testing in every test module ever. Kind of a dorky way to implement this, but... --- mediagoblin/tests/test_globals.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'mediagoblin/tests/test_globals.py') diff --git a/mediagoblin/tests/test_globals.py b/mediagoblin/tests/test_globals.py index fe3088f8..dafd71db 100644 --- a/mediagoblin/tests/test_globals.py +++ b/mediagoblin/tests/test_globals.py @@ -17,6 +17,9 @@ import pytest from mediagoblin import mg_globals +from mediagoblin.tools.testing import _activate_testing + +_activate_testing() class TestGlobals(object): -- cgit v1.2.3 From 9a9bafc078192317695a4f06233ea261fe147989 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Fri, 17 May 2013 11:12:56 -0500 Subject: Reverting "Always activate testing in every test module ever." Revert "Always activate testing in every test module ever." This reverts commit 0536306048daa0970d2e43411ba2a9bf073e570e. --- mediagoblin/tests/test_globals.py | 3 --- 1 file changed, 3 deletions(-) (limited to 'mediagoblin/tests/test_globals.py') diff --git a/mediagoblin/tests/test_globals.py b/mediagoblin/tests/test_globals.py index dafd71db..fe3088f8 100644 --- a/mediagoblin/tests/test_globals.py +++ b/mediagoblin/tests/test_globals.py @@ -17,9 +17,6 @@ import pytest from mediagoblin import mg_globals -from mediagoblin.tools.testing import _activate_testing - -_activate_testing() class TestGlobals(object): -- cgit v1.2.3