code format
This commit is contained in:
@@ -13,7 +13,8 @@ void Create::id(const std::string& _id) {
|
|||||||
|
|
||||||
CocoaTweet::API::Model::Tweet Create::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth) {
|
CocoaTweet::API::Model::Tweet Create::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth) {
|
||||||
CocoaTweet::API::Model::Tweet tweet;
|
CocoaTweet::API::Model::Tweet tweet;
|
||||||
HttpPost::process(_oauth, [&tweet](const unsigned int _responseCode, const std::string& _rcv) {
|
HttpPost::process(_oauth,
|
||||||
|
[&tweet](const unsigned int _responseCode, const std::string& _rcv) {
|
||||||
tweet = CocoaTweet::API::Model::Tweet(_responseCode, _rcv);
|
tweet = CocoaTweet::API::Model::Tweet(_responseCode, _rcv);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -11,9 +11,11 @@ void Destroy::id(const std::string& _id) {
|
|||||||
bodyParam_.insert_or_assign("id", _id);
|
bodyParam_.insert_or_assign("id", _id);
|
||||||
}
|
}
|
||||||
|
|
||||||
CocoaTweet::API::Model::Tweet Destroy::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth) {
|
CocoaTweet::API::Model::Tweet Destroy::process(
|
||||||
|
std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth) {
|
||||||
CocoaTweet::API::Model::Tweet tweet;
|
CocoaTweet::API::Model::Tweet tweet;
|
||||||
HttpPost::process(_oauth, [&tweet](const unsigned int _responseCode, const std::string& _rcv) {
|
HttpPost::process(_oauth,
|
||||||
|
[&tweet](const unsigned int _responseCode, const std::string& _rcv) {
|
||||||
tweet = CocoaTweet::API::Model::Tweet(_responseCode, _rcv);
|
tweet = CocoaTweet::API::Model::Tweet(_responseCode, _rcv);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -25,8 +25,6 @@ private:
|
|||||||
std::string createdAt_;
|
std::string createdAt_;
|
||||||
std::string text_;
|
std::string text_;
|
||||||
std::string source_;
|
std::string source_;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
} // namespace CocoaTweet::API::Model
|
} // namespace CocoaTweet::API::Model
|
||||||
|
|
||||||
|
|||||||
@@ -11,11 +11,7 @@ class Key {
|
|||||||
const std::string accessTokenSecret_;
|
const std::string accessTokenSecret_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Key()
|
Key() : consumerKey_(""), consumerSecret_(""), accessToken_(""), accessTokenSecret_("") {}
|
||||||
: consumerKey_(""),
|
|
||||||
consumerSecret_(""),
|
|
||||||
accessToken_(""),
|
|
||||||
accessTokenSecret_("") {}
|
|
||||||
Key(const std::string& _consumerKey, const std::string& _consumerSecret,
|
Key(const std::string& _consumerKey, const std::string& _consumerSecret,
|
||||||
const std::string& _accessToken, const std::string& _accessTokenSecret)
|
const std::string& _accessToken, const std::string& _accessTokenSecret)
|
||||||
: consumerKey_(_consumerKey),
|
: consumerKey_(_consumerKey),
|
||||||
|
|||||||
+10
-5
@@ -42,7 +42,8 @@ BOOST_AUTO_TEST_CASE(test03) {
|
|||||||
}]
|
}]
|
||||||
})";
|
})";
|
||||||
|
|
||||||
BOOST_CHECK_THROW(CocoaTweet::API::Model::Tweet(401, json), CocoaTweet::Exception::AuthenticateException);
|
BOOST_CHECK_THROW(CocoaTweet::API::Model::Tweet(401, json),
|
||||||
|
CocoaTweet::Exception::AuthenticateException);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(test04) {
|
BOOST_AUTO_TEST_CASE(test04) {
|
||||||
@@ -53,7 +54,8 @@ BOOST_AUTO_TEST_CASE(test04) {
|
|||||||
}]
|
}]
|
||||||
})";
|
})";
|
||||||
|
|
||||||
BOOST_CHECK_THROW(CocoaTweet::API::Model::Tweet(429, json), CocoaTweet::Exception::RateLimitException);
|
BOOST_CHECK_THROW(CocoaTweet::API::Model::Tweet(429, json),
|
||||||
|
CocoaTweet::Exception::RateLimitException);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(test05) {
|
BOOST_AUTO_TEST_CASE(test05) {
|
||||||
@@ -64,7 +66,8 @@ BOOST_AUTO_TEST_CASE(test05) {
|
|||||||
}]
|
}]
|
||||||
})";
|
})";
|
||||||
|
|
||||||
BOOST_CHECK_THROW(CocoaTweet::API::Model::Tweet(403, json), CocoaTweet::Exception::RateLimitException);
|
BOOST_CHECK_THROW(CocoaTweet::API::Model::Tweet(403, json),
|
||||||
|
CocoaTweet::Exception::RateLimitException);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(test06) {
|
BOOST_AUTO_TEST_CASE(test06) {
|
||||||
@@ -75,7 +78,8 @@ BOOST_AUTO_TEST_CASE(test06) {
|
|||||||
}]
|
}]
|
||||||
})";
|
})";
|
||||||
|
|
||||||
BOOST_CHECK_THROW(CocoaTweet::API::Model::Tweet(403, json), CocoaTweet::Exception::TweetTooLongException);
|
BOOST_CHECK_THROW(CocoaTweet::API::Model::Tweet(403, json),
|
||||||
|
CocoaTweet::Exception::TweetTooLongException);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(test07) {
|
BOOST_AUTO_TEST_CASE(test07) {
|
||||||
@@ -86,6 +90,7 @@ BOOST_AUTO_TEST_CASE(test07) {
|
|||||||
}]
|
}]
|
||||||
})";
|
})";
|
||||||
|
|
||||||
BOOST_CHECK_THROW(CocoaTweet::API::Model::Tweet(403, json), CocoaTweet::Exception::TweetDuplicateException);
|
BOOST_CHECK_THROW(CocoaTweet::API::Model::Tweet(403, json),
|
||||||
|
CocoaTweet::Exception::TweetDuplicateException);
|
||||||
}
|
}
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
|||||||
+2
-2
@@ -15,7 +15,8 @@ BOOST_AUTO_TEST_CASE(test01) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(test02) {
|
BOOST_AUTO_TEST_CASE(test02) {
|
||||||
CocoaTweet::OAuth::Key key("consumerKey", "consumerSecret", "accessToken", "accessTokenSecret");
|
CocoaTweet::OAuth::Key key("consumerKey", "consumerSecret", "accessToken",
|
||||||
|
"accessTokenSecret");
|
||||||
|
|
||||||
BOOST_TEST(key.consumerKey() == "consumerKey");
|
BOOST_TEST(key.consumerKey() == "consumerKey");
|
||||||
BOOST_TEST(key.consumerSecret() == "consumerSecret");
|
BOOST_TEST(key.consumerSecret() == "consumerSecret");
|
||||||
@@ -31,5 +32,4 @@ BOOST_AUTO_TEST_CASE(test02) {
|
|||||||
BOOST_TEST(secret.at("oauth_token") == "accessTokenSecret");
|
BOOST_TEST(secret.at("oauth_token") == "accessTokenSecret");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
|||||||
Reference in New Issue
Block a user