projects
/
gssweb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Commit an overly-large chunk of work.
[gssweb.git]
/
json_gssapi
/
test
/
GSSUnwrapTest.cpp
diff --git
a/json_gssapi/test/GSSUnwrapTest.cpp
b/json_gssapi/test/GSSUnwrapTest.cpp
index
d807b52
..
7b26008
100644
(file)
--- a/
json_gssapi/test/GSSUnwrapTest.cpp
+++ b/
json_gssapi/test/GSSUnwrapTest.cpp
@@
-5,11
+5,16
@@
*
*/
*
*/
+#include <string>
+
#include "GSSUnwrapTest.h"
#include "command_mocks/MockUnwrap.h"
#include "GSSUnwrap.h"
#include "GSSUnwrapTest.h"
#include "command_mocks/MockUnwrap.h"
#include "GSSUnwrap.h"
+#include <datamodel/GSSContext.h>
+#include <cache/GSSContextCache.h>
#include <gssapi/gssapi.h>
#include <gssapi/gssapi.h>
+
CPPUNIT_TEST_SUITE_REGISTRATION( GSSUnwrapTest );
/*
CPPUNIT_TEST_SUITE_REGISTRATION( GSSUnwrapTest );
/*
@@
-138,15
+143,17
@@
void GSSUnwrapTest::testEmptyCall()
void GSSUnwrapTest::testConstructorWithJSONObject()
{
/* Variables */
void GSSUnwrapTest::testConstructorWithJSONObject()
{
/* Variables */
- const char* input = "{\"method\": \"gss_wrap\", \
+ GSSContext context((gss_ctx_id_t)rand(), true);
+ std::string key = GSSContextCache::instance()->store(context);
+ std::string input = "{\"method\": \"gss_wrap\", \
\"arguments\": \
{ \
\"arguments\": \
{ \
- \"context_handle\": \"
#######
\", \
+ \"context_handle\": \"
" + key + "
\", \
\"input_message\": \"mary had a little lamb\" \
}\
}";
json_error_t jsonErr;
\"input_message\": \"mary had a little lamb\" \
}\
}";
json_error_t jsonErr;
- JSONObject json = JSONObject::load(input, 0, &jsonErr);
+ JSONObject json = JSONObject::load(input
.c_str()
, 0, &jsonErr);
GSSUnwrap cmd = GSSUnwrap(&json, &mock_unwrap);
GSSUnwrap cmd = GSSUnwrap(&json, &mock_unwrap);
@@
-155,6
+162,12
@@
void GSSUnwrapTest::testConstructorWithJSONObject()
/* Main */
CPPUNIT_ASSERT_EQUAL_MESSAGE(
/* Main */
CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "GSSUnwrap did not retrieve the GSS context correctly",
+ context.getContext(),
+ cmd.getContextHandle()
+ );
+
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
"GSSUnwrap did not parse the input message argument correctly",
std::string("mary had a little lamb"),
cmd.getInputMessage().toString()
"GSSUnwrap did not parse the input message argument correctly",
std::string("mary had a little lamb"),
cmd.getInputMessage().toString()