[Groonga-commit] groonga/gcs [master] Update tests for XML repsonses

Back to archive index

null+****@clear***** null+****@clear*****
2012年 6月 21日 (木) 15:38:33 JST


SHIMODA Hiroshi	2012-06-21 15:38:33 +0900 (Thu, 21 Jun 2012)

  New Revision: 165df1a81f668699c6042f5564d756a48294e09b
  https://github.com/groonga/gcs/commit/165df1a81f668699c6042f5564d756a48294e09b

  Log:
    Update tests for XML repsonses

  Modified files:
    test/api-configuration.test.js

  Modified: test/api-configuration.test.js (+15 -2)
===================================================================
--- test/api-configuration.test.js    2012-06-21 15:32:31 +0900 (6f88093)
+++ test/api-configuration.test.js    2012-06-21 15:38:33 +0900 (14064ef)
@@ -13,6 +13,17 @@ suiteTeardown(function() {
   temporaryDatabase = undefined;
 });
 
+function createCommonErrorResponse(errorCode, message) {
+  return '<?xml version="1.0"?>\n' +
+         '<Response>' +
+           '<Errors>' +
+             '<Error><Code>' + errorCode +'</Code>' +
+                     '<Message>' + message + '</Message></Error>' +
+             '</Errors>' +
+           '<RequestID></RequestID>' +
+         '</Response>';
+}
+
 suite('Configuration API', function() {
   var database;
   var server;
@@ -123,9 +134,10 @@ suite('Configuration API', function() {
     var path = '/?Version=2011-02-01';
     utils.get(path)
       .next(function(response) {
+        var message = 'The request is missing an action or operation parameter.';
         var expected = {
               statusCode: 400,
-              body: 'Action must be given as the parameter "Action".'
+              body: createCommonErrorResponse('InvalidAction', message)
             };
         assert.deepEqual(response, expected);
         done();
@@ -139,9 +151,10 @@ suite('Configuration API', function() {
     var path = '/?Version=2011-02-01&Action=unknown';
     utils.get(path)
       .next(function(response) {
+        var message = 'The action unknown is not valid for this web service.';
         var expected = {
               statusCode: 400,
-              body: 'Action "unknown" is not supported.'
+              body: createCommonErrorResponse('InvalidAction', message)
             };
         assert.deepEqual(response, expected);
         done();
-------------- next part --------------
HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...
Download 



Groonga-commit メーリングリストの案内
Back to archive index