incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [3/34] git commit: [#4785] Fixed ShortUrl tests from prior changes
Date Tue, 02 Oct 2012 21:30:28 GMT
[#4785] Fixed ShortUrl tests from prior changes

Signed-off-by: Cory Johns <johnsca@geek.net>


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/cfa7a444
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/cfa7a444
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/cfa7a444

Branch: refs/heads/db/4968
Commit: cfa7a444959b9a5655af3df6eb5c32b128ea5579
Parents: d48f262
Author: Cory Johns <johnsca@geek.net>
Authored: Tue Oct 2 19:28:45 2012 +0000
Committer: Cory Johns <johnsca@geek.net>
Committed: Tue Oct 2 19:28:45 2012 +0000

----------------------------------------------------------------------
 ForgeShortUrl/forgeshorturl/tests/test_commands.py |   24 ++++++++------
 1 files changed, 14 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cfa7a444/ForgeShortUrl/forgeshorturl/tests/test_commands.py
----------------------------------------------------------------------
diff --git a/ForgeShortUrl/forgeshorturl/tests/test_commands.py b/ForgeShortUrl/forgeshorturl/tests/test_commands.py
index 874d2ff..4ccf60e 100644
--- a/ForgeShortUrl/forgeshorturl/tests/test_commands.py
+++ b/ForgeShortUrl/forgeshorturl/tests/test_commands.py
@@ -1,3 +1,4 @@
+from nose.tools import assert_equal
 from alluratest.controller import setup_basic_test, setup_global_objects
 from forgeshorturl.command import migrate_urls
 from forgeshorturl.model import ShortUrl
@@ -48,20 +49,23 @@ class TableMock(MagicMock):
 @patch('sqlalchemy.Table', TableMock)
 def test_migrate_urls():
     p = M.Project.query.find().first()
-    assert ShortUrl.query.find({'project_id': p._id}).count() == 0
+    app = p.app_instance('url')
+    if not app:
+        app = p.install_app('ShortUrl')
+    assert_equal(ShortUrl.query.find({'app_config_id': app.config._id}).count(), 0)
 
     cmd = migrate_urls.MigrateUrls('migrate-urls')
     cmd.run([test_config, 'db_name', str(p._id)])
-    assert ShortUrl.query.find({'project_id': p._id}).count() == 2
+    assert_equal(ShortUrl.query.find({'app_config_id': app.config._id}).count(), 2)
 
-    u = ShortUrl.query.get(short_name='g')
-    assert u.url == 'http://google.com'
-    assert u.description == 'Two\nlines'
+    u = ShortUrl.query.find(dict(app_config_id=app.config._id, short_name='g')).first()
+    assert_equal(u.full_url, 'http://google.com')
+    assert_equal(u.description, 'Two\nlines')
     assert not u.private
-    assert u.create_user == M.User.anonymous()._id
+    assert_equal(u.create_user, M.User.anonymous()._id)
 
-    u = ShortUrl.query.get(short_name='y')
-    assert u.url == 'http://yahoo.com'
-    assert u.description == 'One line'
+    u = ShortUrl.query.find(dict(app_config_id=app.config._id, short_name='y')).first()
+    assert_equal(u.full_url, 'http://yahoo.com')
+    assert_equal(u.description, 'One line')
     assert u.private
-    assert u.create_user == M.User.anonymous()._id
+    assert_equal(u.create_user, M.User.anonymous()._id)


Mime
View raw message