incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [4/4] git commit: [#6388] start working on script
Date Tue, 17 Dec 2013 21:28:11 GMT
[#6388] start working on script


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

Branch: refs/heads/db/6388
Commit: 97755d126b334ddaa2ca0ee28a2c1c9839ccb91d
Parents: c4f5bb7
Author: Dave Brondsema <dbrondsema@slashdotmedia.com>
Authored: Tue Dec 17 21:27:56 2013 +0000
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Tue Dec 17 21:27:56 2013 +0000

----------------------------------------------------------------------
 scripts/perf/call_count.py | 65 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/97755d12/scripts/perf/call_count.py
----------------------------------------------------------------------
diff --git a/scripts/perf/call_count.py b/scripts/perf/call_count.py
new file mode 100755
index 0000000..96b8b20
--- /dev/null
+++ b/scripts/perf/call_count.py
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+
+#       Licensed to the Apache Software Foundation (ASF) under one
+#       or more contributor license agreements.  See the NOTICE file
+#       distributed with this work for additional information
+#       regarding copyright ownership.  The ASF licenses this file
+#       to you under the Apache License, Version 2.0 (the
+#       "License"); you may not use this file except in compliance
+#       with the License.  You may obtain a copy of the License at
+#
+#         http://www.apache.org/licenses/LICENSE-2.0
+#
+#       Unless required by applicable law or agreed to in writing,
+#       software distributed under the License is distributed on an
+#       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#       KIND, either express or implied.  See the License for the
+#       specific language governing permissions and limitations
+#       under the License.
+
+from pylons import tmpl_context as c
+
+from allura import model as M
+from allura.lib.helpers import push_config, push_context
+from allura.tests import TestController
+
+from forgewiki import model as WM
+
+
+def main():
+    test = TestController()
+    thread = setup(test)
+    load_page(test, thread)
+
+
+def setup(test):
+    # includes setting up mim
+    test.setUp()
+    # automagically instantiate the app
+    test.app.get('/wiki/')
+
+    project = M.Project.query.get(shortname='test')
+    app = project.app_instance('wiki')
+
+    page = WM.Page.query.get(app_config_id=app.config._id, title='Home')
+    thread = page.discussion_thread
+    # create 3 posts by 2 users
+    with push_config(c, user=M.User.query.get(username='test-admin'),
+                        app=app,
+                        project=project):
+        thread.add_post(text='This is very helpful')
+        thread.add_post(text="But it's not **super** helpful")
+        with push_config(c, user=M.User.query.get(username='test-user')):
+            thread.add_post(text='I disagree')
+
+    return thread
+
+
+def load_page(test, thread):
+
+    print test.app.get('/p/test/wiki/_discuss/thread/{}/'.format(thread._id),
+                       extra_environ=dict(username='*anonymous'))
+    test.tearDown()
+
+if __name__ == '__main__':
+    main()


Mime
View raw message