Skip to content

Commit

Permalink
update examples and unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentluce committed Dec 8, 2010
1 parent f6b29ad commit 9390682
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Examples.cpp
Expand Up @@ -97,7 +97,7 @@ int main () {
// Twilio Utils
Utils u (ACCOUNT_SID, ACCOUNT_TOKEN);

// get completed calls XML
// validate request signature
vars.clear();
var.key = "Status";
var.value = "completed";
Expand Down
17 changes: 17 additions & 0 deletions UnitTests.h
Expand Up @@ -10,6 +10,7 @@
using namespace std;

#include "cxxtest/TestSuite.h"
#include "Utils.h"
#include "Rest.h"
#include "TwiML.h"

Expand Down Expand Up @@ -82,6 +83,22 @@ class TwilioTestSuite : public CxxTest::TestSuite
response2.append(gather);
response2.append(redirect);
TS_ASSERT(response2.toXML() == "<Response><Gather numDigits=\"10\"><Say><![CDATA[Press 1]]></Say></Gather><Redirect></Redirect></Response>");
}

void testUtils(void)
{
vector<Var> vars;
Var var;

// Twilio Utils
Utils u (ACCOUNT_SID, ACCOUNT_TOKEN);

// validate request signature
vars.clear();
var.key = "Status";
var.value = "completed";
vars.push_back(var);
TS_ASSERT(u.validateRequest("mGgsPkY=", "/" + API_VERSION + "/Accounts/" + ACCOUNT_SID + "/Calls", vars));
}

private:
Expand Down

0 comments on commit 9390682

Please sign in to comment.