[Groonga-commit] droonga/droonga-engine at 15c2aca [master] Add tests for missing required parameter

Back to archive index

YUKI Hiroshi null+****@clear*****
Fri Nov 7 16:26:14 JST 2014


YUKI Hiroshi	2014-11-07 16:26:14 +0900 (Fri, 07 Nov 2014)

  New Revision: 15c2aca5a1bc6a3a9de273855e64660ab950b51e
  https://github.com/droonga/droonga-engine/commit/15c2aca5a1bc6a3a9de273855e64660ab950b51e

  Message:
    Add tests for missing required parameter

  Modified files:
    test/unit/plugins/groonga/test_table_create.rb

  Modified: test/unit/plugins/groonga/test_table_create.rb (+29 -0)
===================================================================
--- test/unit/plugins/groonga/test_table_create.rb    2014-11-07 16:19:49 +0900 (f4f8435)
+++ test/unit/plugins/groonga/test_table_create.rb    2014-11-07 16:26:14 +0900 (471a542)
@@ -54,30 +54,35 @@ table_create Books TABLE_NO_KEY
            },
            "TABLE_HASH_KEY" => {
              :flags => "TABLE_HASH_KEY",
+             :key_type => "ShortText",
              :schema => <<-SCHEMA,
 table_create Books TABLE_HASH_KEY ShortText
              SCHEMA
            },
            "TABLE_PAT_KEY" => {
              :flags => "TABLE_PAT_KEY",
+             :key_type => "ShortText",
              :schema => <<-SCHEMA,
 table_create Books TABLE_PAT_KEY ShortText
              SCHEMA
            },
            "TABLE_DAT_KEY" => {
              :flags => "TABLE_DAT_KEY",
+             :key_type => "ShortText",
              :schema => <<-SCHEMA,
 table_create Books TABLE_DAT_KEY ShortText
              SCHEMA
            },
            "KEY_WITH_SIS with TABLE_PAT_KEY" => {
              :flags => "KEY_WITH_SIS|TABLE_PAT_KEY",
+             :key_type => "ShortText",
              :schema => <<-SCHEMA,
 table_create Books TABLE_PAT_KEY|KEY_WITH_SIS ShortText
              SCHEMA
            },
            "KEY_WITH_SIS without TABLE_PAT_KEY" => {
              :flags => "TABLE_NO_KEY|KEY_WITH_SIS",
+             :key_type => "ShortText",
              :schema => <<-SCHEMA,
 table_create Books TABLE_NO_KEY
              SCHEMA
@@ -88,9 +93,33 @@ table_create Books TABLE_NO_KEY
         "name" => "Books",
         "flags" => data[:flags],
       }
+      request["key_type"] = data[:key_type] if data[:key_type]
       process(:table_create, request)
       assert_equal(data[:schema], dump)
     end
+
+    data({
+           "TABLE_HASH_KEY missing key_type" => {
+             :flags => "TABLE_HASH_KEY",
+           },
+           "TABLE_PAT_KEY missing key_type" => {
+             :flags => "TABLE_PAT_KEY",
+           },
+           "TABLE_DAT_KEY missing key_type" => {
+             :flags => "TABLE_DAT_KEY",
+           },
+         })
+    def test_missing_required_parameter(data)
+      request = {
+        "name" => "Books",
+        "flags" => data[:flags],
+      }
+      response = process(:table_create, request)
+      assert_equal(
+        [NORMALIZED_HEADER_INVALID_ARGUMENT, false],
+        [normalize_header(response.first), response.last]
+      )
+    end
   end
 
   class KeyTypeTest < self
-------------- next part --------------
HTML����������������������������...
下載 



More information about the Groonga-commit mailing list
Back to archive index