You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by ke...@apache.org on 2019/11/18 21:46:26 UTC
[allura] 11/11: [#8340] discussion test coverage improvement
This is an automated email from the ASF dual-hosted git repository.
kentontaylor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git
commit 604dd9f253e7c4cc8db291b04df9dec09add8420
Author: Dave Brondsema <da...@brondsema.net>
AuthorDate: Fri Nov 15 18:13:33 2019 -0500
[#8340] discussion test coverage improvement
---
Allura/allura/controllers/secure.py | 23 -----------------------
ForgeDiscussion/forgediscussion/tests/test_app.py | 22 ++++++++++++++++++++--
2 files changed, 20 insertions(+), 25 deletions(-)
diff --git a/Allura/allura/controllers/secure.py b/Allura/allura/controllers/secure.py
deleted file mode 100644
index 899ad42..0000000
--- a/Allura/allura/controllers/secure.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# 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.
-
-"""Sample controller with all its actions protected."""
-
-# This controller is only used when you activate auth. You can safely remove
-# this file from your project.
diff --git a/ForgeDiscussion/forgediscussion/tests/test_app.py b/ForgeDiscussion/forgediscussion/tests/test_app.py
index 4e23cfa..e980fc1 100644
--- a/ForgeDiscussion/forgediscussion/tests/test_app.py
+++ b/ForgeDiscussion/forgediscussion/tests/test_app.py
@@ -23,16 +23,34 @@ import tempfile
import json
import os
from operator import attrgetter
+from cgi import FieldStorage
from nose.tools import assert_equal
from tg import tmpl_context as c
from cStringIO import StringIO
+
+from forgediscussion.site_stats import posts_24hr
from ming.orm import ThreadLocalORMSession
-from cgi import FieldStorage
from allura import model as M
+from allura.tests import decorators as td
from forgediscussion.tests.functional.test_rest import TestDiscussionApiBase
-from forgediscussion.model.forum import Forum
+from forgediscussion.model.forum import Forum, ForumPost
+
+
+class TestApp(TestDiscussionApiBase): # creates some sample data
+
+ @td.with_discussion
+ def test_uninstall(self):
+ assert ForumPost.query.get(text='Hi boys and girls')
+ # c.app.uninstall(c.project) errors out, but works ok in test_uninstall for repo tools. So instead:
+ c.project.uninstall_app('discussion')
+ assert not ForumPost.query.get(text='Hi boys and girls')
+
+ @td.with_discussion
+ def test_tickets_stats_24hr(self):
+ # invoked normally via entry point
+ assert_equal(2, posts_24hr())
class TestBulkExport(TestDiscussionApiBase):