You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2015/04/15 16:55:04 UTC

[5/8] allura git commit: simplify test.ini further, adjust lots of test failures due to inheriting development.ini settings

simplify test.ini further, adjust lots of test failures due to inheriting development.ini settings


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

Branch: refs/heads/db/7870
Commit: fd2c258240933b68e439b33d440748258a9f71e9
Parents: 97eb3ac
Author: Dave Brondsema <da...@brondsema.net>
Authored: Tue Apr 14 10:07:05 2015 -0400
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Tue Apr 14 17:38:05 2015 -0400

----------------------------------------------------------------------
 Allura/allura/lib/plugin.py                     |   4 +
 Allura/allura/tests/functional/test_auth.py     |   2 +
 .../tests/functional/test_neighborhood.py       |   2 +-
 .../tests/functional/test_user_profile.py       |   4 +-
 Allura/allura/tests/unit/test_app.py            |   4 +-
 .../tests/unit/test_ldap_auth_provider.py       |  10 +-
 Allura/development.ini                          |  20 +--
 Allura/setup.py                                 |   3 +
 Allura/test.ini                                 | 139 +++++++++++--------
 9 files changed, 111 insertions(+), 77 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/fd2c2582/Allura/allura/lib/plugin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/plugin.py b/Allura/allura/lib/plugin.py
index fb1c3b9..f28839c 100644
--- a/Allura/allura/lib/plugin.py
+++ b/Allura/allura/lib/plugin.py
@@ -546,9 +546,13 @@ class LdapAuthenticationProvider(AuthenticationProvider):
         algorithm = config.get(cfg_prefix + 'algorithm', 6)
         rounds = asint(config.get(cfg_prefix + 'rounds', 6000))
         salt = self._get_salt(salt_len) if salt is None else salt
+        # FIXME on OSX bug?
+        # allura.tests.unit.test_ldap_auth_provider:TestLdapAuthenticationProvider.test_password_encoder
+        print salt
         encrypted = crypt.crypt(
             password.encode('utf-8'),
             '$%s$rounds=%s$%s' % (algorithm, rounds, salt))
+        print encrypted
         return '{CRYPT}%s' % encrypted
 
     def by_username(self, username):

http://git-wip-us.apache.org/repos/asf/allura/blob/fd2c2582/Allura/allura/tests/functional/test_auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_auth.py b/Allura/allura/tests/functional/test_auth.py
index f288b0b..f19b506 100644
--- a/Allura/allura/tests/functional/test_auth.py
+++ b/Allura/allura/tests/functional/test_auth.py
@@ -763,9 +763,11 @@ class TestAuth(TestController):
 
     def test_no_open_return_to(self):
         r = self.app.get('/auth/logout')
+        print 11
         r = self.app.post('/auth/do_login', params=dict(
             username='test-user', password='foo',
             return_to='/foo'))
+        print 22
         assert_equal(r.location, 'http://localhost/foo')
 
         r = self.app.get('/auth/logout')

http://git-wip-us.apache.org/repos/asf/allura/blob/fd2c2582/Allura/allura/tests/functional/test_neighborhood.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_neighborhood.py b/Allura/allura/tests/functional/test_neighborhood.py
index 332a60b..afe4dc6 100644
--- a/Allura/allura/tests/functional/test_neighborhood.py
+++ b/Allura/allura/tests/functional/test_neighborhood.py
@@ -281,7 +281,7 @@ class TestNeighborhood(TestController):
                           extra_environ=dict(username='root'))
         r = self.app.get('/adobe/adobe-1/admin/overview',
                          extra_environ=dict(username='root'))
-        assert "_add_tracking('nbhd', 'U-123456');" in r
+        assert "_add_tracking('nbhd', 'U-123456');" in r, r
         assert "_add_tracking('proj', 'U-654321');" in r
         # analytics not allowed
         neighborhood = M.Neighborhood.query.get(name='Adobe')

http://git-wip-us.apache.org/repos/asf/allura/blob/fd2c2582/Allura/allura/tests/functional/test_user_profile.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_user_profile.py b/Allura/allura/tests/functional/test_user_profile.py
index a3ea741..c539baf 100644
--- a/Allura/allura/tests/functional/test_user_profile.py
+++ b/Allura/allura/tests/functional/test_user_profile.py
@@ -80,7 +80,7 @@ class TestUserProfile(TestController):
 
         sendsimplemail.post.assert_called_once_with(
             cc=User.by_username('test-admin').get_pref('email_address'),
-            text=u'test message\n\n---\n\nThis message was sent to you via the Allura web mail form.  You may reply to this message directly, or send a message to Test Admin at http://localhost/u/test-admin/profile/send_message\n',
+            text=u'test message\n\n---\n\nThis message was sent to you via the Allura web mail form.  You may reply to this message directly, or send a message to Test Admin at http://localhost:8080/u/test-admin/profile/send_message\n',
             toaddr=User.by_username('test-user').get_pref('email_address'),
             fromaddr=User.by_username('test-admin').get_pref('email_address'),
             reply_to=User.by_username('test-admin').get_pref('email_address'),
@@ -93,7 +93,7 @@ class TestUserProfile(TestController):
 
         sendsimplemail.post.assert_called_once_with(
             cc=None,
-            text=u'test message\n\n---\n\nThis message was sent to you via the Allura web mail form.  You may reply to this message directly, or send a message to Test Admin at http://localhost/u/test-admin/profile/send_message\n',
+            text=u'test message\n\n---\n\nThis message was sent to you via the Allura web mail form.  You may reply to this message directly, or send a message to Test Admin at http://localhost:8080/u/test-admin/profile/send_message\n',
             toaddr=User.by_username('test-user').get_pref('email_address'),
             fromaddr=User.by_username('test-admin').get_pref('email_address'),
             reply_to=User.by_username('test-admin').get_pref('email_address'),

http://git-wip-us.apache.org/repos/asf/allura/blob/fd2c2582/Allura/allura/tests/unit/test_app.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/unit/test_app.py b/Allura/allura/tests/unit/test_app.py
index 95c56c5..eca1ae7 100644
--- a/Allura/allura/tests/unit/test_app.py
+++ b/Allura/allura/tests/unit/test_app.py
@@ -17,6 +17,8 @@
 
 from unittest import TestCase
 
+from nose.tools import assert_equal
+
 from allura.app import Application
 from allura import model
 from allura.tests.unit import WithDatabase
@@ -100,7 +102,7 @@ class TestAppDefaults(WithDatabase):
 
     def test_email_address(self):
         self.app.url = '/p/project/mount-point/'
-        assert self.app.email_address == 'mount-point@project.p.in.localhost'
+        assert_equal(self.app.email_address, 'mount-point@project.p.in.localhost')
 
 
 def install_app():

http://git-wip-us.apache.org/repos/asf/allura/blob/fd2c2582/Allura/allura/tests/unit/test_ldap_auth_provider.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/unit/test_ldap_auth_provider.py b/Allura/allura/tests/unit/test_ldap_auth_provider.py
index 1dc4bf3..7d7f5b5 100644
--- a/Allura/allura/tests/unit/test_ldap_auth_provider.py
+++ b/Allura/allura/tests/unit/test_ldap_auth_provider.py
@@ -53,7 +53,7 @@ class TestLdapAuthenticationProvider(object):
         self.provider._encode_password = Mock(return_value='new-pass-hash')
         ldap.dn.escape_dn_chars = lambda x: x
 
-        dn = 'uid=%s,ou=users,dc=sf,dc=net' % user.username
+        dn = 'uid=%s,ou=people,dc=localdomain' % user.username
         self.provider.set_password(user, 'old-pass', 'new-pass')
         ldap.initialize.assert_called_once_with('ldaps://localhost/')
         connection = ldap.initialize.return_value
@@ -74,7 +74,7 @@ class TestLdapAuthenticationProvider(object):
 
         self.provider._login()
 
-        dn = 'uid=%s,ou=users,dc=sf,dc=net' % params['username']
+        dn = 'uid=%s,ou=people,dc=localdomain' % params['username']
         ldap.initialize.assert_called_once_with('ldaps://localhost/')
         connection = ldap.initialize.return_value
         connection.bind_s.called_once_with(dn, 'test-password')
@@ -90,7 +90,7 @@ class TestLdapAuthenticationProvider(object):
         self.provider.request.method = 'POST'
         self.provider.request.body = '&'.join(['%s=%s' % (k,v) for k,v in params.iteritems()])
         ldap.dn.escape_dn_chars = lambda x: x
-        dn = 'uid=%s,ou=users,dc=sf,dc=net' % params['username']
+        dn = 'uid=%s,ou=people,dc=localdomain' % params['username']
         conn = ldap.initialize.return_value
         conn.search_s.return_value = [(dn, {'cn': [u'åℒƒ'.encode('utf-8')]})]
 
@@ -117,11 +117,11 @@ class TestLdapAuthenticationProvider(object):
         ThreadLocalORMSession.flush_all()
         assert_not_equal(M.User.query.get(username=user_doc['username']), None)
 
-        dn = 'uid=%s,ou=users,dc=sf,dc=net' % user_doc['username']
+        dn = 'uid=%s,ou=people,dc=localdomain' % user_doc['username']
         ldap.initialize.assert_called_once_with('ldaps://localhost/')
         connection = ldap.initialize.return_value
         connection.bind_s.called_once_with(
-            'cn=site,ou=admin,dc=sf,dc=net',
+            'cn=admin,dc=localdomain',
             'admin-password')
         connection.add_s.assert_called_once_with(dn, modlist.addModlist.return_value)
         connection.unbind_s.assert_called_once()

http://git-wip-us.apache.org/repos/asf/allura/blob/fd2c2582/Allura/development.ini
----------------------------------------------------------------------
diff --git a/Allura/development.ini b/Allura/development.ini
index 68f2136..45eb98b 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -40,6 +40,9 @@ debug = true
 ;email_to = you@yourdomain.com
 error_email_from = paste@localhost
 
+; TODO:
+; move these configs out of [DEFAULT] so they can be overriden  ??
+
 ; SMTP settings for outgoing mail
 smtp_tls = false
 smtp_ssl = false
@@ -49,11 +52,8 @@ smtp_timeout = 10
 smtp_server = localhost
 smtp_port = 8826
 ; Reply-To and From address often used in email notifications:
-forgemail.return_path = noreply@sf.net
+forgemail.return_path = noreply@localhost
 
-; Used to uniquify references to static resources, can be a timestamp or any unique value
-; This should be updated each time you deploy (or make significant changes, like new tools, new css)
-build_key=1276635823
 
 [server:main]
 use = egg:Paste#http
@@ -75,6 +75,10 @@ site_name = Allura
 domain = localhost
 base_url = http://localhost:8080
 
+; Used to uniquify references to static resources, can be a timestamp or any unique value
+; This should be updated each time you deploy (or make significant changes, like new tools, new css)
+build_key=1276635823
+
 ; Used by Turbogears / Pylons in some cases.  Not particularly relevant for Allura.
 cache_dir = %(here)s/data
 
@@ -126,7 +130,7 @@ auth.max_password_len = 30
 
 ; if using LDAP, also run `pip install python-ldap` in your Allura environment
 
-auth.ldap.server = ldap://localhost
+auth.ldap.server = ldaps://localhost/
 auth.ldap.suffix = ou=people,dc=localdomain
 auth.ldap.admin_dn = cn=admin,dc=localdomain
 auth.ldap.admin_password = secret
@@ -188,7 +192,7 @@ webhook.retry = 60 120 240
 ; Option format: webhook.<hook type>.limit,
 ; all '-' in hook type must be changed to '_'
 ; e.g. for repo-push webhook:
-webhook.repo_push.limit = 10
+webhook.repo_push.limit = 30
 ; Limit max number of hooks that can be created for given project/app
 ; Option name format: same as above.
 ; Value format: json dict, where keys are app names (as appears in
@@ -360,7 +364,7 @@ stats.sample_rate = 1
 monq.poll_interval=2
 
 ; SOLR setup
-solr.server = http://localhost:8983/solr
+solr.server = http://localhost:8983/solrMAIN
 ; Alternate server to use just for querying
 ;solr.query_server =
 ; Shorter timeout for search queries (longer timeout for saving to solr)
@@ -381,7 +385,7 @@ forgemail.host = 0.0.0.0
 forgemail.port = 8825
 ; domain suffix for your mail, change this.  You also need to route *.*.*.forgemail.domain to the above host/port via
 ; your mail and DNS configuration
-forgemail.domain = .in.sf.net
+forgemail.domain = .in.localhost
 ; probably unused?
 forgemail.url = http://localhost:8080
 

http://git-wip-us.apache.org/repos/asf/allura/blob/fd2c2582/Allura/setup.py
----------------------------------------------------------------------
diff --git a/Allura/setup.py b/Allura/setup.py
index e44c0c2..99fb419 100644
--- a/Allura/setup.py
+++ b/Allura/setup.py
@@ -90,6 +90,9 @@ setup(
         ('templates/**.html', 'genshi', None),
         ('public/**', 'ignore', None)]},
 
+    # These entry points define what tools and plugins are available for Allura.
+    # Other packages (the Forge* directories) or 3rd-party can add more too.
+    # development.ini is used for many cases to specify which to actually use.
     entry_points="""
     [paste.app_factory]
     main = allura.config.middleware:make_app

http://git-wip-us.apache.org/repos/asf/allura/blob/fd2c2582/Allura/test.ini
----------------------------------------------------------------------
diff --git a/Allura/test.ini b/Allura/test.ini
index 101a427..6c6c945 100644
--- a/Allura/test.ini
+++ b/Allura/test.ini
@@ -18,38 +18,47 @@
 # allura - testing configuration
 #
 #
+
+;
+; This inherits all the settings from development.ini
+; and then overrides a few for testing
+;
+
 [DEFAULT]
-debug = false
 
-smtp_server = localhost
 
-[server:main]
-use = egg:Paste#http
-host = 0.0.0.0
-port = 5000
+;smtp_server = localhost
+
+;[server:main]
+;use = egg:Paste#http
+;host = 0.0.0.0
+;port = 5000
 
 [app:main]
 use = config:development.ini#main
+;full_stack = True
 override_root=basetest_project_root ; TurboGears will use controllers/basetest_project_root.py as root controller
 disable_template_overrides = True
 
+; required so that g.production_mode is True, and Google Analytics is included (weird.)
+; may also be useful for other reasons during tests (e.g. not intercepting error handling)
+debug = false
+
 # Use in-memory MongoDB
 ming.main.uri = mim:///allura
 ming.project.uri = mim:///project-data
 ming.task.uri = mim:///task
 
-trovecategories.enableediting = true
-
 # ActivityStream
 activitystream.master = mim://
-activitystream.database = activitystream
-activitystream.activity_collection = activities
-activitystream.node_collection = nodes
-activitystream.timeline_collection = timelines
-activitystream.recording.enabled = true
-activitystream.enabled = true
-
-solr.mock = true
+;activitystream.database = activitystream
+;activitystream.activity_collection = activities
+;activitystream.node_collection = nodes
+;activitystream.timeline_collection = timelines
+;activitystream.recording.enabled = true
+;activitystream.enabled = true
+
+solr.server =
 smtp.mock = true
 
 
@@ -60,74 +69,84 @@ site_admin_project = test
 # useful primarily for test suites, where we want to see the error right away
 monq.raise_errors = true
 
-# Set the locations of some static resources
-#  script_name is the path that is handled by the application
-#  url_base is the prefix that references to the static resources should have
+; specify these without any build_key being included
 ew.script_name = /nf/_ew_/
 ew.url_base = /nf/_ew_/
 static.script_name = /nf/_static_/
 static.url_base = /nf/_static_/
 
-scm.host.ro.git = git://git.localhost$path
-scm.host.rw.git = ssh://$username@localhost:8022/scm-repo$path
-scm.host.https.git = https://$username@localhost:8022/scm-repo$path
-scm.host.https_anon.git = https://localhost:8022/scm-repo$path
-scm.host.ro.hg = http://hg.localhost$path
-scm.host.rw.hg = ssh://$username@localhost:8022/scm-repo$path
-scm.host.https.hg = https://$username@localhost:8022/scm-repo$path
-scm.host.https_anon.hg = https://localhost:8022/scm-repo$path
-scm.host.ro.svn = http://svn.localhost$path/
-scm.host.rw.svn = svn+ssh://$username@localhost:8022/scm-repo$path/
-scm.host.https.svn = https://$username@localhost:8022/scm-repo$path/
-scm.host.https_anon.svn = https://localhost:8022/scm-repo$path/
-
-scm.clone.git = git clone $source_url $dest_path
-scm.clone.hg = hg clone $source_url $dest_path
-scm.clone.https_anon.svn = svn checkout $source_url $dest_path
-scm.clone.ro.svn = svn checkout $source_url $dest_path
-scm.clone.svn = svn checkout --username=$username $source_url $dest_path
-
+;
+;scm.host.ro.git = git://git.localhost$path
+;scm.host.rw.git = ssh://$username@localhost:8022/scm-repo$path
+;scm.host.https.git = https://$username@localhost:8022/scm-repo$path
+;scm.host.https_anon.git = https://localhost:8022/scm-repo$path
+;scm.host.ro.hg = http://hg.localhost$path
+;scm.host.rw.hg = ssh://$username@localhost:8022/scm-repo$path
+;scm.host.https.hg = https://$username@localhost:8022/scm-repo$path
+;scm.host.https_anon.hg = https://localhost:8022/scm-repo$path
+;scm.host.ro.svn = http://svn.localhost$path/
+;scm.host.rw.svn = svn+ssh://$username@localhost:8022/scm-repo$path/
+;scm.host.https.svn = https://$username@localhost:8022/scm-repo$path/
+;scm.host.https_anon.svn = https://localhost:8022/scm-repo$path/
+;
+;scm.clone.git = git clone $source_url $dest_path
+;scm.clone.hg = hg clone $source_url $dest_path
+;scm.clone.https_anon.svn = svn checkout $source_url $dest_path
+;scm.clone.ro.svn = svn checkout $source_url $dest_path
+;scm.clone.svn = svn checkout --username=$username $source_url $dest_path
+;
 scm.repos.root = /tmp
-scm.repos.tarball.enable = true
-scm.repos.tarball.root = /tmp/tarball
-scm.repos.tarball.url_prefix = file://
+;scm.repos.tarball.enable = true
+;scm.repos.tarball.root = /tmp/tarball
+;scm.repos.tarball.url_prefix = file://
+;
+;bulk_export_path = /tmp/bulk_export/{nbhd}/{project}
 
-bulk_export_path = /tmp/bulk_export/{nbhd}/{project}
+; TODO: make this and tests match development.ini
 bulk_export_filename = {project}.zip
-bulk_export_download_instructions = Sample instructions for {project}
 
-support_tool_choices = wiki tickets discussion
+;bulk_export_download_instructions = Sample instructions for {project}
+
+;support_tool_choices = wiki tickets discussion
 
 
 # markdown text longer than max length will not be converted to html
 # tests expect max length of 40000
 markdown_render_max_length = 40000
 
-user_message.time_interval = 3600
-user_message.max_messages = 200
+;user_message.max_messages = 200
 
-auth.min_password_len = 6
-auth.max_password_len = 30
+; TODO: update tests and remove this setting override
+auth.require_email_addr = false
 
-# LDAP auth provider
-auth.ldap.server = ldaps://localhost/
-auth.ldap.suffix = ou=users,dc=sf,dc=net
-auth.ldap.admin_dn = cn=site,ou=admin,dc=sf,dc=net
-auth.ldap.admin_password = admin-password
-auth.ldap.use_schroot = False
-auth.ldap.password.algorithm = 6
-auth.ldap.password.rounds = 6000
-auth.ldap.password.salt_len = 16
-user_prefs_storage.ldap.fields.display_name = cn
+; if enabled during tests, TimerMiddleware will end up wrapping requests way too many times instead of just once
+; not necessary anyway
+stats.sample_rate = 0
 
-auth.allow_user_to_disable_account = true
-auth.allow_edit_prefs = true
+
+# LDAP auth provider
+;auth.ldap.server = ldaps://localhost/
+;auth.ldap.suffix = ou=users,dc=sf,dc=net
+;auth.ldap.admin_dn = cn=site,ou=admin,dc=sf,dc=net
+;auth.ldap.admin_password = admin-password
+;auth.ldap.use_schroot = False
+;auth.ldap.password.algorithm = 6
+;auth.ldap.password.rounds = 6000
+;auth.ldap.password.salt_len = 16
+;user_prefs_storage.ldap.fields.display_name = cn
+;
+;auth.allow_user_to_disable_account = true
+;auth.allow_edit_prefs = true
 
 
 
 # Add additional test specific configuration options as necessary.
 [loggers]
 keys = root, allura
+; TODO: ./run_tests will capture ming.mim DEBUG output
+; but running a test individually ok
+
+; TODO: forgeblog.tests.test_commands:test_plaintext_preprocessor_wrapped fails with slight difference in output
 
 [handlers]
 keys = test