forked from gma/python-satisfaction
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Retrieve a reply's topics from topic's first page.
- Loading branch information
Showing
4 changed files
with
300 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,191 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<feed | ||
xmlns="http://www.w3.org/2005/Atom" | ||
xmlns:sfn="http://api.getsatisfaction.com/schema/0.1" | ||
xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" | ||
xmlns:thr="http://purl.org/syndication/thread/1.0"> | ||
<id>http://api.getsatisfaction.com/topics/397900</id> | ||
<title>Finding KEI</title> | ||
|
||
<updated>2009-08-19T07:40:01Z</updated> | ||
<published>2009-05-04T04:18:06Z</published> | ||
<link rel="self" href="http://api.getsatisfaction.com/topics/397900?page=1" type="application/atom+xml"/> | ||
<link rel="first" href="http://api.getsatisfaction.com/topics/397900?page=1" type="application/atom+xml"/> | ||
<link rel="last" href="http://api.getsatisfaction.com/topics/397900?page=1" type="application/atom+xml"/> | ||
|
||
|
||
<link rel="company" href="http://api.getsatisfaction.com/companies/30884" type="text/html"/> | ||
<link rel="replies" href="http://api.getsatisfaction.com/topics/397900/replies" type="application/atom+xml"/> | ||
<sfn:id>397900</sfn:id> | ||
|
||
|
||
|
||
|
||
<entry> | ||
|
||
|
||
|
||
|
||
<id>http://api.getsatisfaction.com/topics/397900</id> | ||
<link rel="topic" href="http://api.getsatisfaction.com/topics/397900" type="application/atom+xml"/> | ||
<link rel="topic_at_sfn" href="http://getsatisfaction.com/wordtracker/topics/finding_kei" type="text/html"/> | ||
<link rel="company" href="http://api.getsatisfaction.com/companies/30884" type="text/html"/> | ||
<link rel="replies" href="http://api.getsatisfaction.com/topics/397900/replies" type="application/atom+xml"/> | ||
<sfn:id>397900</sfn:id> | ||
|
||
|
||
<title type="html">Finding KEI</title> | ||
<updated>2009-08-19T07:40:01Z</updated> | ||
<published>2009-05-04T04:18:06Z</published> | ||
|
||
<author> | ||
<name>ray sherman</name> | ||
<uri>http://api.getsatisfaction.com/people/553157</uri> | ||
<sfn:avatar>http://getsatisfaction.com/images/user_default_medium.png</sfn:avatar> | ||
<sfn:canonical_name>ray_sherman</sfn:canonical_name> | ||
</author> | ||
|
||
<content type="html"> | ||
|
||
How do you find kEI with this new version? | ||
</content> | ||
|
||
<sfn:topic_style>question</sfn:topic_style> | ||
<sfn:user_defined_code>false</sfn:user_defined_code> | ||
<sfn:status></sfn:status> | ||
<sfn:reply_count>3</sfn:reply_count> | ||
<sfn:follower_count>5</sfn:follower_count> | ||
<sfn:flag_count>0</sfn:flag_count> | ||
<sfn:me_too_count>3</sfn:me_too_count> | ||
<sfn:most_recent_activity>comment</sfn:most_recent_activity> | ||
|
||
<sfn:tags></sfn:tags> | ||
|
||
|
||
|
||
</entry> | ||
|
||
|
||
|
||
<entry> | ||
|
||
|
||
<id>http://api.getsatisfaction.com/topics/397900/replies/1060959</id> | ||
<link rel="reply" href="http://api.getsatisfaction.com/topics/397900/replies/1060959" type="application/atom+xml"/> | ||
<link rel="topic" href="http://api.getsatisfaction.com/topics/397900" type="application/atom+xml"/> | ||
<link rel="stars" href="http://api.getsatisfaction.com/topics/397900/replies/1060959/stars" type="application/atom+xml"/> | ||
|
||
<thr:in-reply-to>http://api.getsatisfaction.com/topics/397900</thr:in-reply-to> | ||
<sfn:id>1060959</sfn:id> | ||
|
||
<title>Mal Darwen responded to "Finding KEI"</title> | ||
|
||
<updated>2009-05-05T09:22:05Z</updated> | ||
<published>2009-05-05T09:22:05Z</published> | ||
|
||
<author> | ||
<name>Mal Darwen</name> | ||
<uri>http://api.getsatisfaction.com/people/508365</uri> | ||
<sfn:avatar>http://s3.amazonaws.com/satisfaction-production/public/uploaded_images/2787645/malthumb_medium.jpg</sfn:avatar> | ||
<sfn:canonical_name>mal_darwen</sfn:canonical_name> | ||
</author> | ||
<content type="html"> | ||
Hi Ray, <br /><br /> | ||
thanks for writing. The beta version of the new tool does not give a calculation of KEI (keyword effectiveness index) which has traditionally been used to rank keywords. <br /> | ||
We have been testing more effective metrics to allow you to rank keywords and this will soon be included in the new tool. | ||
</content> | ||
|
||
<sfn:flag_count>0</sfn:flag_count> | ||
<sfn:star_count>1</sfn:star_count> | ||
|
||
|
||
<sfn:company_promoted /> | ||
|
||
|
||
<sfn:emotitag face="happy" severity="1"> | ||
|
||
</sfn:emotitag> | ||
|
||
</entry> | ||
|
||
|
||
<entry> | ||
|
||
|
||
<id>http://api.getsatisfaction.com/topics/397900/replies/1313227</id> | ||
<link rel="reply" href="http://api.getsatisfaction.com/topics/397900/replies/1313227" type="application/atom+xml"/> | ||
<link rel="topic" href="http://api.getsatisfaction.com/topics/397900" type="application/atom+xml"/> | ||
<link rel="stars" href="http://api.getsatisfaction.com/topics/397900/replies/1313227/stars" type="application/atom+xml"/> | ||
|
||
<thr:in-reply-to>http://api.getsatisfaction.com/topics/397900</thr:in-reply-to> | ||
<sfn:id>1313227</sfn:id> | ||
|
||
<title>Michael Chou responded to "Finding KEI"</title> | ||
|
||
<updated>2009-08-19T03:48:12Z</updated> | ||
<published>2009-08-19T03:48:12Z</published> | ||
|
||
<author> | ||
<name>Michael Chou</name> | ||
<uri>http://api.getsatisfaction.com/people/693397</uri> | ||
<sfn:avatar>http://getsatisfaction.com/images/user_default_medium.png</sfn:avatar> | ||
<sfn:canonical_name>michael_chou</sfn:canonical_name> | ||
</author> | ||
<content type="html"> | ||
when?!?!? | ||
</content> | ||
|
||
<sfn:flag_count>0</sfn:flag_count> | ||
<sfn:star_count>0</sfn:star_count> | ||
|
||
|
||
|
||
|
||
|
||
<sfn:emotitag face="sad" severity="1"> | ||
sad | ||
</sfn:emotitag> | ||
|
||
</entry> | ||
|
||
|
||
<entry> | ||
|
||
|
||
<id>http://api.getsatisfaction.com/topics/397900/replies/1313567</id> | ||
<link rel="reply" href="http://api.getsatisfaction.com/topics/397900/replies/1313567" type="application/atom+xml"/> | ||
<link rel="topic" href="http://api.getsatisfaction.com/topics/397900" type="application/atom+xml"/> | ||
<link rel="stars" href="http://api.getsatisfaction.com/topics/397900/replies/1313567/stars" type="application/atom+xml"/> | ||
|
||
<thr:in-reply-to>http://api.getsatisfaction.com/topics/397900</thr:in-reply-to> | ||
<sfn:id>1313567</sfn:id> | ||
|
||
<title>Mal Darwen responded to "Finding KEI"</title> | ||
|
||
<updated>2009-08-19T07:40:01Z</updated> | ||
<published>2009-08-19T07:40:01Z</published> | ||
|
||
<author> | ||
<name>Mal Darwen</name> | ||
<uri>http://api.getsatisfaction.com/people/508365</uri> | ||
<sfn:avatar>http://s3.amazonaws.com/satisfaction-production/public/uploaded_images/2787645/malthumb_medium.jpg</sfn:avatar> | ||
<sfn:canonical_name>mal_darwen</sfn:canonical_name> | ||
</author> | ||
<content type="html"> | ||
Hi Michael, <br /><br /> | ||
we don't have a firm date for the introduction of these metrics yet - we're still assessing which will be the most effective to include in the tool, but this is likely to be in the next few months. | ||
</content> | ||
|
||
<sfn:flag_count>0</sfn:flag_count> | ||
<sfn:star_count>0</sfn:star_count> | ||
|
||
|
||
|
||
|
||
|
||
<sfn:emotitag face="happy" severity="1"> | ||
happy | ||
</sfn:emotitag> | ||
|
||
</entry> | ||
</feed> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<feed | ||
xmlns="http://www.w3.org/2005/Atom" | ||
xmlns:sfn="http://api.getsatisfaction.com/schema/0.1" | ||
xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" | ||
xmlns:thr="http://purl.org/syndication/thread/1.0"> | ||
<id>http://api.getsatisfaction.com/topics/409678</id> | ||
<title>Fantastic improvement</title> | ||
|
||
<updated>2009-05-14T17:42:27Z</updated> | ||
<published>2009-05-14T17:42:27Z</published> | ||
<link rel="self" href="http://api.getsatisfaction.com/topics/409678?page=1" type="application/atom+xml"/> | ||
<link rel="first" href="http://api.getsatisfaction.com/topics/409678?page=1" type="application/atom+xml"/> | ||
<link rel="last" href="http://api.getsatisfaction.com/topics/409678?page=1" type="application/atom+xml"/> | ||
|
||
|
||
<link rel="company" href="http://api.getsatisfaction.com/companies/30884" type="text/html"/> | ||
<link rel="replies" href="http://api.getsatisfaction.com/topics/409678/replies" type="application/atom+xml"/> | ||
<sfn:id>409678</sfn:id> | ||
|
||
|
||
|
||
|
||
<entry> | ||
|
||
|
||
|
||
|
||
<id>http://api.getsatisfaction.com/topics/409678</id> | ||
<link rel="topic" href="http://api.getsatisfaction.com/topics/409678" type="application/atom+xml"/> | ||
<link rel="topic_at_sfn" href="http://getsatisfaction.com/wordtracker/topics/fantastic_improvement" type="text/html"/> | ||
<link rel="company" href="http://api.getsatisfaction.com/companies/30884" type="text/html"/> | ||
<link rel="replies" href="http://api.getsatisfaction.com/topics/409678/replies" type="application/atom+xml"/> | ||
<sfn:id>409678</sfn:id> | ||
|
||
|
||
<title type="html">Fantastic improvement</title> | ||
<updated>2009-05-14T17:42:27Z</updated> | ||
<published>2009-05-14T17:42:27Z</published> | ||
|
||
<author> | ||
<name>Mark</name> | ||
<uri>http://api.getsatisfaction.com/people/565338</uri> | ||
<sfn:avatar>http://getsatisfaction.comhttp://s3.amazonaws.com/satisfaction-production/public/uploaded_images/2820949/1970_medium.JPG</sfn:avatar> | ||
<sfn:canonical_name>mark_293104</sfn:canonical_name> | ||
</author> | ||
|
||
<content type="html"> | ||
|
||
Fantastic improvement over the previous interface. Well done! | ||
</content> | ||
|
||
<sfn:topic_style>praise</sfn:topic_style> | ||
<sfn:user_defined_code>false</sfn:user_defined_code> | ||
<sfn:status></sfn:status> | ||
<sfn:reply_count>0</sfn:reply_count> | ||
<sfn:follower_count>1</sfn:follower_count> | ||
<sfn:flag_count>0</sfn:flag_count> | ||
<sfn:me_too_count>1</sfn:me_too_count> | ||
<sfn:most_recent_activity>create</sfn:most_recent_activity> | ||
|
||
<sfn:tags></sfn:tags> | ||
|
||
|
||
|
||
</entry> | ||
|
||
</feed> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,53 @@ | ||
import os | ||
import unittest2 as unittest | ||
|
||
import satisfaction | ||
|
||
|
||
def fixture(cls, name): | ||
def wrapper(test): | ||
def test_with_fixture(*args): | ||
def stubbed_url(self, topic_id): | ||
fixture = "%s-%s.xml" % (cls.__name__.lower(), name) | ||
return os.path.join(os.getcwd(), "fixtures", fixture) | ||
|
||
try: | ||
original_url = cls.url | ||
cls.url = stubbed_url | ||
return test(*args) | ||
finally: | ||
cls.url = original_url | ||
return test_with_fixture | ||
return wrapper | ||
|
||
|
||
class TopicTest(unittest.TestCase): | ||
|
||
def topic(self, topic_id="409678"): | ||
return satisfaction.Topic(topic_id) | ||
|
||
def test_when_topic_doesnt_exist_then_not_found(self): | ||
with self.assertRaises(satisfaction.ResourceNotFound): | ||
self.topic("bad-id").title | ||
|
||
@fixture(satisfaction.Topic, "without-replies") | ||
def test_when_topic_exists_then_title_available(self): | ||
self.assertEqual(self.topic().title, "Fantastic improvement") | ||
self.assertEqual("Fantastic improvement", self.topic().title) | ||
|
||
@fixture(satisfaction.Topic, "without-replies") | ||
def test_when_topic_exists_then_content_available(self): | ||
self.assertIn("Well done!", self.topic().content) | ||
|
||
def test_when_topic_has_no_replies_then_no_replies_returned(self): | ||
@fixture(satisfaction.Topic, "without-replies") | ||
def test_when_topic_has_no_replies_then_no_replies_found(self): | ||
self.assertEqual(0, self.topic().reply_count) | ||
self.assertEqual(0, len(list(self.topic().replies))) | ||
|
||
@fixture(satisfaction.Topic, "with-replies") | ||
def test_when_topic_has_several_replies_then_replies_found(self): | ||
self.assertEqual(3, self.topic().reply_count) | ||
self.assertEqual(3, len(list(self.topic().replies))) | ||
|
||
|
||
if __name__ == '__main__': | ||
if __name__ == "__main__": | ||
unittest.main() |