summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2010-10-04 18:36:02 -0700
committerZach Copley <zach@status.net>2010-10-06 13:40:01 -0700
commit30537700786967f8fd3c91ff3a7b5fc1acf09fe8 (patch)
tree7b13878c711146d1fee85db9e3d0600c4b3863d9
parent82f05d0a61752d0552bc8029b2a55ab7c5171b33 (diff)
A bit more work on the request token fetching test script
-rwxr-xr-xtests/oauth/getrequesttoken.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/oauth/getrequesttoken.php b/tests/oauth/getrequesttoken.php
index 7c0888354..fc6f03379 100755
--- a/tests/oauth/getrequesttoken.php
+++ b/tests/oauth/getrequesttoken.php
@@ -2,7 +2,7 @@
<?php
/*
* StatusNet - a distributed open-source microblogging tool
- * Copyright (C) 2008, 2009, StatusNet, Inc.
+ * Copyright (C) 2008-2010, StatusNet, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -24,6 +24,15 @@ require_once INSTALLDIR . '/scripts/commandline.inc';
require_once INSTALLDIR . '/extlib/OAuth.php';
$ini = parse_ini_file("oauth.ini");
+
+// Check to make sure we have everything we need from the ini file
+foreach(array('consumer_key', 'consumer_secret', 'apiroot', 'request_token_url') as $inikey) {
+ if (empty($ini[$inikey])) {
+ print "You forgot to specify a $inikey in your oauth.ini file.\n";
+ exit(1);
+ }
+}
+
$test_consumer = new OAuthConsumer($ini['consumer_key'], $ini['consumer_secret']);
$rt_endpoint = $ini['apiroot'] . $ini['request_token_url'];
$parsed = parse_url($rt_endpoint);
@@ -37,6 +46,7 @@ try {
$req_req->sign_request($hmac_method, $test_consumer, NULL);
$r = httpRequest($req_req->to_url());
} catch (Exception $e) {
+ // oh noez
print $e->getMessage();
var_dump($req_req);
exit(1);