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
/
GSSPseudoRandomTest.cpp
diff --git
a/json_gssapi/test/GSSPseudoRandomTest.cpp
b/json_gssapi/test/GSSPseudoRandomTest.cpp
index
12693ad
..
e38ab49
100644
(file)
--- a/
json_gssapi/test/GSSPseudoRandomTest.cpp
+++ b/
json_gssapi/test/GSSPseudoRandomTest.cpp
@@
-6,14
+6,17
@@
*/
#include <algorithm>
*/
#include <algorithm>
+#include <string>
//#include <cppunit/TestFixture.h>
//#include <cppunit/extensions/HelperMacros.h>
#include <openssl/rand.h>
//#include <cppunit/TestFixture.h>
//#include <cppunit/extensions/HelperMacros.h>
#include <openssl/rand.h>
+#include "cache/GSSContextCache.h"
+#include "datamodel/GSSContext.h"
+#include "command_mocks/MockPseudoRandom.h"
#include "GSSPseudoRandom.h"
#include "GSSPseudoRandomTest.h"
#include "GSSPseudoRandom.h"
#include "GSSPseudoRandomTest.h"
-#include "command_mocks/MockPseudoRandom.h"
// Registers the fixture into the 'registry'
CPPUNIT_TEST_SUITE_REGISTRATION( GSSPseudoRandomTest );
// Registers the fixture into the 'registry'
CPPUNIT_TEST_SUITE_REGISTRATION( GSSPseudoRandomTest );
@@
-173,7
+176,7
@@
void GSSPseudoRandomTest::testEmptyCall()
* {"method": "gss_pseudo_random",
* "arguments":
* {
* {"method": "gss_pseudo_random",
* "arguments":
* {
- * "context_handle": "
########
",
+ * "context_handle": "
context handle key
",
* "prf_key": ###,
* "prf_in": "la la la input message",
* "desired_output_len": ####
* "prf_key": ###,
* "prf_in": "la la la input message",
* "desired_output_len": ####
@@
-183,17
+186,20
@@
void GSSPseudoRandomTest::testEmptyCall()
void GSSPseudoRandomTest::testConstructorWithJSONObject()
{
/* Variables */
void GSSPseudoRandomTest::testConstructorWithJSONObject()
{
/* Variables */
- const char* input = "{\"method\": \"gss_pseudo_random\", \
+ GSSContext context( (gss_ctx_id_t)rand(), true );
+ std::string key = GSSContextCache::instance()->store(context);
+
+ std::string input = "{\"method\": \"gss_pseudo_random\", \
\"arguments\": \
{ \
\"arguments\": \
{ \
- \"context_handle\": \"
#######
\", \
+ \"context_handle\": \"
" + key + "
\", \
\"prf_key\": 1234567890, \
\"prf_in\": \"mary had a little lamb\", \
\"desired_output_len\": 256 \
}\
}";
json_error_t jsonErr;
\"prf_key\": 1234567890, \
\"prf_in\": \"mary had a little lamb\", \
\"desired_output_len\": 256 \
}\
}";
json_error_t jsonErr;
- JSONObject json = JSONObject::load(input, 0, &jsonErr);
+ JSONObject json = JSONObject::load(input
.c_str()
, 0, &jsonErr);
GSSPseudoRandom cmd = GSSPseudoRandom(&json, &mock_gss_pseudo_random);
GSSPseudoRandom cmd = GSSPseudoRandom(&json, &mock_gss_pseudo_random);
@@
-202,6
+208,12
@@
void GSSPseudoRandomTest::testConstructorWithJSONObject()
/* Main */
CPPUNIT_ASSERT_EQUAL_MESSAGE(
/* Main */
CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "GSSWrap did not retrive the GSS context correctly",
+ context.getContext(),
+ cmd.getContextHandle()
+ );
+
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
"GSSPseudoRandom did not parse the prf_key argument correctly.",
1234567890,
cmd.getKey()
"GSSPseudoRandom did not parse the prf_key argument correctly.",
1234567890,
cmd.getKey()