Permalink
Browse files

Added 'get_community_settings'.

  • Loading branch information...
1 parent 2a025a3 commit 888bdb540a9cb172d847997c224f0736a1be9364 @bboe bboe committed Apr 18, 2012
Showing with 18 additions and 4 deletions.
  1. +6 −0 reddit/__init__.py
  2. +5 −3 reddit/objects.py
  3. +7 −1 reddit/reddit_test.py
View
@@ -358,6 +358,12 @@ def get_banned(self, subreddit):
six.text_type(subreddit))
@reddit.decorators.require_login
+ def get_community_settings(self, subreddit):
+ """Get the community settings for a subreddit."""
+ return self.request_json(self.config['subreddit_settings'] %
+ six.text_type(subreddit))['data']
+
+ @reddit.decorators.require_login
def get_contributors(self, subreddit):
"""Get the list of contributors for a subreddit."""
return self.request_json(self.config['contributors'] %
View
@@ -657,9 +657,6 @@ def clear_all_flair(self):
else:
return
- def get_community_settings():
- pass
-
def clear_flair_templates(self, *args, **kwargs):
"""Clear flair templates for this subreddit."""
return self.reddit_session.clear_flair_templates(self, *args, **kwargs)
@@ -672,6 +669,11 @@ def get_banned(self, *args, **kwargs):
"""Get banned users for this subreddit."""
return self.reddit_session.get_banned(self, *args, **kwargs)
+ def get_community_settings(self, *args, **kwargs):
+ """Get the community settings for a subreddit."""
+ return self.reddit_session.get_community_settings(self, *args,
+ **kwargs)
+
def get_contributors(self, *args, **kwargs):
"""Get contributors for this subreddit."""
return self.reddit_session.get_contributors(self, *args, **kwargs)
View
@@ -318,11 +318,17 @@ def test_user_comment_replies_are_none(self):
self.fail('Could not find comment on other user\'s list')
-class StylesheetTest(unittest.TestCase, AuthenticatedHelper):
+class SettingsTest(unittest.TestCase, AuthenticatedHelper):
def setUp(self):
self.configure()
self.subreddit = self.r.get_subreddit(self.sr)
+ def test_update_settings(self):
+ title = 'Reddit API Test %s' % uuid.uuid4()
+ self.subreddit.update_community_settings(title)
+ self.assertEqual(self.subreddit.get_community_settings()['title'],
+ title)
+
def test_update_stylesheet(self):
stylesheet = ('div.titlebox span.number:after {\ncontent: " %s"\n' %
uuid.uuid4())

0 comments on commit 888bdb5

Please sign in to comment.