X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=json_gssapi%2Ftest%2FGSSWrapTest.cpp;h=c361dc1a373fa272a506435eb8703be0f528c2f5;hb=455aa320df24be80f5bae58b9038f72532d8d6b2;hp=50dbf2db81b7d4f50494e8841eab9bcb2e663791;hpb=3b13c3828653d78787eb96c0273ac2605985c41a;p=gssweb.git diff --git a/json_gssapi/test/GSSWrapTest.cpp b/json_gssapi/test/GSSWrapTest.cpp index 50dbf2d..c361dc1 100644 --- a/json_gssapi/test/GSSWrapTest.cpp +++ b/json_gssapi/test/GSSWrapTest.cpp @@ -33,10 +33,8 @@ mock_wrap( { /* Error checking */ /* Variables */ - std::string buffer; /* Setup */ - buffer = MockWrap::outputMessageBuffer.toString(); /* Main */ // Copy our input from the appropriate parameters to MockWrap @@ -49,8 +47,7 @@ mock_wrap( // copy our output to the appropriate parameters *minor_status = MockWrap::minor_status; *conf_state = MockWrap::conf_state; - output_message_buffer->length = buffer.length(); - output_message_buffer->value = (void *)buffer.c_str(); + *output_message_buffer = *MockWrap::outputMessageBuffer.toGss(); /* Cleanup */ /* return */ @@ -88,7 +85,7 @@ void GSSWrapTest::testEmptyCall() GSSBuffer input((char *)"Input message"); gss_qop_t desiredQop = rand(); int desiredConf = rand(); - gss_ctx_id_t desiredContext = (gss_ctx_id_t)rand(); + gss_ctx_id_t desiredContext = (gss_ctx_id_t)( (long)0 | rand() ); /* Error checking */ /* Setup */ @@ -164,18 +161,16 @@ void GSSWrapTest::testEmptyCall() void GSSWrapTest::testConstructorWithJSONObject() { /* Variables */ - GSSContext context( (gss_ctx_id_t)rand(), true ); + GSSContext context( (gss_ctx_id_t)( (long)0 | rand()), + true ); std::string key = GSSContextCache::instance()->store(context); - std::string input = "{\"method\": \"gss_wrap\", \ - \"arguments\": \ - { \ + std::string input = "{ \ \"context_handle\": \"" + key + "\", \ \"conf_req\": \"TRUE\", \ \"qop_req\": \"GSS_C_QOP_DEFAULT\", \ \"input_message\": \"mary had a little lamb\" \ - }\ - }"; + }"; json_error_t jsonErr; JSONObject json = JSONObject::load(input.c_str(), 0, &jsonErr); @@ -248,29 +243,23 @@ void GSSWrapTest::testJSONMarshal() result = cmd.toJSON(); // std::cout << "\nGSSWrap JSON: \n" << result->dump() << "\n"; - CPPUNIT_ASSERT_EQUAL_MESSAGE( - "The command name is incorrect", - std::string("gss_wrap"), - std::string( (*result)["command"].string() ) - ); - CPPUNIT_ASSERT_EQUAL_MESSAGE( "The return value was reported incorrectly", (int)MockWrap::retVal, - (int)( (*result)["return_values"]["major_status"].integer() ) + (int)( (*result)["major_status"].integer() ) ); CPPUNIT_ASSERT_EQUAL_MESSAGE( "The minor_status value was reported incorrectly", (int)MockWrap::minor_status, - (int)( (*result)["return_values"]["minor_status"].integer() ) + (int)( (*result)["minor_status"].integer() ) ); CPPUNIT_ASSERT_EQUAL_MESSAGE( "The output message was reported incorrectly", MockWrap::outputMessageBuffer.toString(), - std::string( (*result)["return_values"]["output_message"].string() ) + std::string( (*result)["output_message"].string() ) );