Adding more owner tests, and removing references to owner from a lot of other tests.
authorNathan Bird <nathan@acceleration.net>
Mon, 25 Jan 2010 22:07:10 +0000 (17:07 -0500)
committerNathan Bird <nathan@acceleration.net>
Tue, 26 Jan 2010 20:50:55 +0000 (15:50 -0500)
tests/test-fddl.lisp
tests/test-init.lisp

index 067088c486894910e1f71f0f8d10de70ae3ec161..fde195db6d0e30990fb1bce8e26676f5e5b34742 100644 (file)
@@ -40,7 +40,7 @@
 (deftest :fddl/table/1
     (with-dataset *ds-fddl*
       (sort (mapcar #'string-downcase
-                   (clsql:list-tables :owner *test-database-user*))
+                   (clsql:list-tables ))
            #'string<))
   ("alpha" "bravo"))
 
                                 ([name] (string 24))
                                 ([comments] longchar)))
           (values
-           (clsql:table-exists-p [foo] :owner *test-database-user*)
+           (clsql:table-exists-p [foo])
            (progn
              (clsql:drop-table [foo] :if-does-not-exist :ignore)
-             (clsql:table-exists-p [foo] :owner *test-database-user*))))
+             (clsql:table-exists-p [foo]))))
   t nil)
 
 ;; create a table, list its attributes and drop it
      (with-dataset *ds-fddl*
        (sort
        (mapcar #'string-downcase
-               (clsql:list-attributes [alpha] :owner *test-database-user*))
+               (clsql:list-attributes [alpha] ))
        #'string<)))
   "a" "c" "d" "f")
 
       (apply #'values
             (sort
              (mapcar #'(lambda (a) (string-downcase (car a)))
-                     (clsql:list-attribute-types [alpha]
-                                                 :owner *test-database-user*))
+                     (clsql:list-attribute-types [alpha]))
              #'string<)))
   "a" "c" "d" "f")
 
       (progn (clsql:create-index [bar] :on [alpha] :attributes
                                 '([a] [c]) :unique t)
             (values
-              (clsql:index-exists-p [bar] :owner *test-database-user*)
+              (clsql:index-exists-p [bar] )
               (progn
                 (clsql:drop-index [bar] :on [alpha]
                                   :if-does-not-exist :ignore)
-                (clsql:index-exists-p [bar] :owner *test-database-user*)))))
+                (clsql:index-exists-p [bar])))))
   t nil)
 
 ;; create indexes with names as strings, symbols and in square brackets
            (result '()))
        (dolist (name names)
          (clsql:create-index name :on [alpha] :attributes '([a]))
-         (push (clsql:index-exists-p name :owner *test-database-user*) result)
+         (push (clsql:index-exists-p name ) result)
          (clsql:drop-index name :on [alpha] :if-does-not-exist :ignore))
        (apply #'values result)))
   t t t)
        (sort
        (mapcar
         #'string-downcase
-        (clsql:list-indexes :on [i3test] :owner *test-database-user*))
+        (clsql:list-indexes :on [i3test]))
        #'string-lessp)
        (progn
         (clsql:drop-index [bar] :on [i3test])
 (deftest :fddl/sequence/1
     (progn (clsql:create-sequence [foo])
           (values
-           (clsql:sequence-exists-p [foo] :owner *test-database-user*)
+           (clsql:sequence-exists-p [foo])
            (progn
              (clsql:drop-sequence [foo] :if-does-not-exist :ignore)
-             (clsql:sequence-exists-p [foo] :owner *test-database-user*))))
+             (clsql:sequence-exists-p [foo]))))
   t nil)
 
 ;; create and increment a sequence
          (length (clsql:list-tables :owner nil)))))
   t)
 
+(deftest :fddl/owner/table
+    (with-dataset *ds-fddl*
+      (values
+       (clsql-sys:table-exists-p [alpha])
+       (clsql-sys:table-exists-p [alpha] :owner *test-database-user*)
+       (clsql-sys:table-exists-p [alpha] :owner *test-false-database-user*)))
+  t t nil)
+
+(deftest :fddl/owner/attributes
+    (with-dataset *ds-fddl*
+      (values
+       (length (clsql-sys:list-attributes [alpha]))
+       (length (clsql-sys:list-attributes [alpha] :owner *test-database-user*))
+       (length (clsql-sys:list-attributes [alpha] :owner *test-false-database-user*))))
+  4 4 0)
+
+(deftest :fddl/owner/attribute-types
+    (with-dataset *ds-fddl*
+      (values
+       (length (clsql:list-attribute-types [alpha]))
+       (length (clsql:list-attribute-types [alpha] :owner *test-database-user*))
+       (length (clsql:list-attribute-types [alpha] :owner *test-false-database-user*))))
+  4 4 0)
+
+(deftest :fddl/owner/index
+    (with-dataset *ds-fddl*
+      (progn (clsql:create-index [bar] :on [alpha]
+                                :attributes '([a] [c]))
+            (values
+              (clsql:index-exists-p [bar] )
+              (clsql:index-exists-p [bar] :owner *test-database-user*)
+              (clsql:index-exists-p [bar] :owner *test-false-database-user*)
+              
+              (length (clsql-sys:list-indexes :on [alpha]))
+              (length (clsql-sys:list-indexes :on [alpha] :owner *test-database-user*))
+              (length (clsql-sys:list-indexes :on [alpha] :owner *test-false-database-user*))
+              (progn
+                (clsql:drop-index [bar] :on [alpha]
+                                  :if-does-not-exist :ignore)
+                (clsql:index-exists-p [bar] :owner *test-database-user*))
+              (clsql:index-exists-p [bar] ))))
+  t t nil
+  1 1 0
+  nil nil)
+
+(deftest :fddl/owner/sequence
+    (progn (clsql:create-sequence [foo])
+          (values
+           (clsql:sequence-exists-p [foo])
+           (clsql:sequence-exists-p [foo] :owner *test-database-user*)
+           (clsql:sequence-exists-p [foo] :owner *test-false-database-user*)
+           
+           (progn
+             (clsql:drop-sequence [foo] :if-does-not-exist :ignore)
+             (clsql:sequence-exists-p [foo] ))))
+  t t nil nil)
+
+
+
 (deftest :fddl/cache-table-queries/1
     (with-dataset *ds-fddl*
       (list
index 1a8ab66aa2e61608d56b3608aa583f8e8646b461..e64a2acb921a8fcea310830abe954e795624e539 100644 (file)
@@ -30,6 +30,8 @@
 (defvar *test-database-type* nil)
 (defvar *test-database-underlying-type* nil)
 (defvar *test-database-user* nil)
+(defvar *test-false-database-user* "adsfjalsdkfjlakjsdfl"
+  "For testing ownership, a user that isn't the owner.")
 (defvar *test-start-utime* nil)
 (defvar *test-connection-spec* nil)
 (defvar *test-connection-db-type* nil)
            (push (cons test "syntax not supported") skip-tests))
           ((and (eq *test-database-type* :odbc)
                 (eq *test-database-underlying-type* :postgresql)
-                (clsql-sys:in test :fddl/owner/1))
+                (clsql-sys:in test :fddl/owner/1 :fddl/owner/table
+                             :fddl/owner/attributes
+                             :fddl/owner/attribute-types
+                             :fddl/owner/index
+                             :fddl/owner/sequence))
            (push (cons test "table ownership not supported by postgresql odbc driver") skip-tests))
           ((and (not (member *test-database-underlying-type*
                              '(:postgresql :oracle)))
-                (clsql-sys:in test :fddl/owner/1))
+                (clsql-sys:in test :fddl/owner/1 :fddl/owner/table
+                             :fddl/owner/attributes
+                             :fddl/owner/attribute-types
+                             :fddl/owner/index
+                             :fddl/owner/sequence))
            (push (cons test "table ownership not supported") skip-tests))
           ((and (null (clsql-sys:db-type-has-intersect? db-underlying-type))
                 (clsql-sys:in test :fdml/query/7))