[jenkinscat-docs] master: Added new test for module books. (9b09d46)
immanetize at fedoraproject.org
immanetize at fedoraproject.org
Sat Feb 7 00:24:03 UTC 2015
Repository : http://git.fedorahosted.org/cgit/jenkinscat-docs.git
On branch : master
>---------------------------------------------------------------
commit 9b09d46a439a415dfbea5d6f8aa46f14a8de147c
Author: Pavel Tisnovsky <ptisnovs at redhat.com>
Date: Fri Feb 6 09:51:40 2015 +0100
Added new test for module books.
>---------------------------------------------------------------
ChangeLog | 5 ++
test/jenkinscat/test_books.clj | 80 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 85 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 878258b..173b16d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2015-02-06 Pavel Tisnovsky <ptisnovs at redhat.com>
+ * test/jenkinscat/test_books.clj:
+ Added new test for module books.
+
+2015-02-06 Pavel Tisnovsky <ptisnovs at redhat.com>
+
* src/jenkinscat/server.clj:
Front page should be generated from cached data.
diff --git a/test/jenkinscat/test_books.clj b/test/jenkinscat/test_books.clj
new file mode 100644
index 0000000..c3b9a3b
--- /dev/null
+++ b/test/jenkinscat/test_books.clj
@@ -0,0 +1,80 @@
+;;; Copyright (c) 2014 Pavel Tisnovsky, Red Hat
+;;; All rights reserved.
+;;;
+;;; Redistribution and use in source and binary forms, with or without
+;;; modification, are permitted provided that the following conditions are met:
+;;; * Redistributions of source code must retain the above copyright
+;;; notice, this list of conditions and the following disclaimer.
+;;; * Redistributions in binary form must reproduce the above copyright
+;;; notice, this list of conditions and the following disclaimer in the
+;;; documentation and/or other materials provided with the distribution.
+;;; * Neither the name of the Red Hat nor the
+;;; names of its contributors may be used to endorse or promote products
+;;; derived from this software without specific prior written permission.
+;;;
+;;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+;;; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+;;; DISCLAIMED. IN NO EVENT SHALL Pavel Tisnovsky BE LIABLE FOR ANY
+;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+;;; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+;;; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+;;; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+;;; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+; Tests for defs and functions defined in the following namespace: jenkinscat.config
+(ns jenkinscat.test-books
+ (:require [clojure.test :refer :all]
+ [clojure.java.io]
+ [jenkinscat.books :refer :all]))
+
+
+
+;
+; Common functions used by tests.
+;
+
+(defn callable?
+ "Test if given function-name is bound to the real function."
+ [function-name]
+ (clojure.test/function? function-name))
+
+
+
+;
+; Actual tests.
+;
+
+(deftest test-read-books-from-books-clj-existence
+ "Check that the jenkinscat.read-books/read-books-from-books-clj definition exists."
+ (testing "if the jenkinscat.read-books/read-books-from-books-clj definition exists."
+ (is (callable? 'jenkinscat.books/read-books-from-books-clj))))
+
+(deftest test-read-books-existence
+ "Check that the jenkinscat.read-books/read-books definition exists."
+ (testing "if the jenkinscat.read-books/read-books definition exists."
+ (is (callable? 'jenkinscat.books/read-books))))
+
+(deftest test-read-books-return-value
+ "Check if the read-books does return the proper value."
+ (testing "if the read-books does return the proper value."
+ (is (not (read-books)))))
+
+(deftest test-read-books-from-books-clj-return-value
+ "Check if the read-books-from-books-clj does return the proper value."
+ (testing "if the read-books-from-books-clj does return the proper value."
+ (is (read-books-from-books-clj))
+ (is (coll? (read-books-from-books-clj)))
+ (is (> (count (read-books-from-books-clj)) 0))))
+
+(deftest test-read-books-definition
+ "Check if the read-books does define proper value."
+ (read-books)
+ (testing "if the read-books does define proper value."
+ (is books)
+ (is (> (count books) 0))
+ (is (coll? books))))
+
More information about the docs-commits
mailing list