def fetchguid(self):
"""Fetch user data and posts using guid.
"""
- request = self._connection.get('people/{0}.json'.format(self.guid))
- self._postproc(request)
+ if self.guid:
+ request = self._connection.get('people/{0}.json'.format(self.guid))
+ self._postproc(request)
+ else:
+ raise errors.UserError('GUID not set')
def fetchprofile(self):
"""Fetches user data.
import warnings
# actual diaspy code
import diaspy
+from diaspy import client as dclient
#### SETUP STUFF
class ClientTests(unittest.TestCase):
- def testGettingStream(self):
- client = diaspy.client.Client(test_connection)
- stream = client.get_stream()
- if len(stream): self.assertEqual(diaspy.models.Post, type(stream[0]))
-
- def testGettingNotifications(self):
- client = diaspy.client.Client(test_connection)
- notifications = client.get_notifications()
- self.assertEqual(diaspy.notifications.Notifications, type(notifications))
- if notifications: self.assertEqual(diaspy.models.Notification, type(notifications[0]))
-
def testGettingTag(self):
- client = diaspy.client.Client(test_connection)
+ client = dclient.Client(test_connection)
tag = client.get_tag('foo')
self.assertEqual(diaspy.streams.Generic, type(tag))
if tag: self.assertEqual(diaspy.models.Post, type(tag[0]))
def testGettingMailbox(self):
- client = diaspy.client.Client(test_connection)
+ client = dclient.Client(test_connection)
mailbox = client.get_mailbox()
self.assertEqual(list, type(mailbox))
self.assertEqual(diaspy.conversations.Conversation, type(mailbox[0]))