summaryrefslogtreecommitdiffabout
authorMichael Krelin <hacker@klever.net>2008-03-08 22:31:50 (UTC)
committer Michael Krelin <hacker@klever.net>2008-03-08 22:31:50 (UTC)
commite6928c1d6c368e999ec8d1b05fccec44c2bebdbc (patch) (unidiff)
treee321a949b69e770fe7d6ea00056ed55e4407def3
parent1d108d28c5c2bd55827021aef944a48421bfb3ef (diff)
downloadlibopkele-e6928c1d6c368e999ec8d1b05fccec44c2bebdbc.zip
libopkele-e6928c1d6c368e999ec8d1b05fccec44c2bebdbc.tar.gz
libopkele-e6928c1d6c368e999ec8d1b05fccec44c2bebdbc.tar.bz2
updated test oauth consumer
Signed-off-by: Michael Krelin <hacker@klever.net>
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--test/test-oauth-consumer.cc6
1 files changed, 1 insertions, 5 deletions
diff --git a/test/test-oauth-consumer.cc b/test/test-oauth-consumer.cc
index c5a0fc0..b3ddef5 100644
--- a/test/test-oauth-consumer.cc
+++ b/test/test-oauth-consumer.cc
@@ -29,33 +29,29 @@ int main(int,char**) {
29 opkele::oauth::token_t( "key","secret" ) ); 29 opkele::oauth::token_t( "key","secret" ) );
30 opkele::oauth::token_t rt = sc.get_request_token(); 30 opkele::oauth::token_t rt = sc.get_request_token();
31 cout << "Request token: " << rt << endl; 31 cout << "Request token: " << rt << endl;
32 cout << "Authorize URL: " << sc.get_authorize_url(rt) << endl; 32 cout << "Authorize URL: " << sc.get_authorize_url(rt) << endl;
33 opkele::oauth::token_t at = sc.get_access_token(rt); 33 opkele::oauth::token_t at = sc.get_access_token(rt);
34 cout << "Access token: " << at << endl; 34 cout << "Access token: " << at << endl;
35 35
36 opkele::fields_t test; 36 opkele::fields_t test;
37 test.set_field("foo","bar"); 37 test.set_field("foo","bar");
38 opkele::util::curl_pick_t curl = opkele::util::curl_t::easy_init(); 38 opkele::util::curl_pick_t curl = opkele::util::curl_t::easy_init();
39 opkele::oauth::http_request_t hr("POST", 39 opkele::oauth::http_request_t hr("POST",
40 "http://term.ie/oauth/example/echo_api.php"); 40 "http://term.ie/oauth/example/echo_api.php");
41 sc.prepare_request(hr,
42 opkele::fields_t(),test,
43 opkele::oauth::oauth_auth_header,"HMAC-SHA1",
44 &at,"realm");
45 CURLcode r = curl.misc_sets(); 41 CURLcode r = curl.misc_sets();
46 r || (r=curl.set_write()); 42 r || (r=curl.set_write());
47 if(r) 43 if(r)
48 throw opkele::exception_curl(OPKELE_CP_ "failed to set curly options",r); 44 throw opkele::exception_curl(OPKELE_CP_ "failed to set curly options",r);
49 hr.setup_curl(curl); 45 sc.prepare_request(hr,opkele::fields_t(),test,&at).setup_curl(curl);
50 if( (r=curl.easy_perform()) ) 46 if( (r=curl.easy_perform()) )
51 throw opkele::exception_curl(OPKELE_CP_ "failed to perform curly request",r); 47 throw opkele::exception_curl(OPKELE_CP_ "failed to perform curly request",r);
52 cout << "Response: " << curl.response << endl; 48 cout << "Response: " << curl.response << endl;
53 49
54#ifdef OPKELE_HAVE_KONFORKA 50#ifdef OPKELE_HAVE_KONFORKA
55 }catch(konforka::exception& e) { 51 }catch(konforka::exception& e) {
56 cerr 52 cerr
57 << "oops, caught " << opkele::util::abi_demangle(typeid(e).name()) << endl 53 << "oops, caught " << opkele::util::abi_demangle(typeid(e).name()) << endl
58 << " what: " << e.what() << endl 54 << " what: " << e.what() << endl
59 << " where: " << e.where() << endl; 55 << " where: " << e.where() << endl;
60 if(!e._seen.empty()) { 56 if(!e._seen.empty()) {
61 cerr << " seen:" << endl; 57 cerr << " seen:" << endl;