Skip to content

Commit f009472

Browse files
committed
Fixing doctests to run against latest Dummy API.
1 parent 35c6396 commit f009472

File tree

3 files changed

+29
-28
lines changed

3 files changed

+29
-28
lines changed

intercom/intercom.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
DEFAULT_TIMEOUT = 10 # seconds
2424

2525

26-
class IntercomError(StandardError):
26+
class IntercomError(Exception):
2727
""" Base error. """
2828
def __init__(self, message, result=None):
2929
super(IntercomError, self).__init__(message)
@@ -337,11 +337,11 @@ def reply_message_thread(
337337
... thread_id=5591,
338338
... body="If you're not talking to me you must be talking to someone")
339339
>>> len(message_thread)
340-
8
340+
9
341341
>>> message_thread['thread_id']
342342
5591
343343
>>> len(message_thread['messages'])
344-
2
344+
3
345345
346346
"""
347347
params = {
@@ -364,12 +364,12 @@ def create_tag(
364364
365365
>>> tag = Intercom.create_tag("Free Trial", "tag",
366366
... user_ids=["abc123", "def456"])
367-
>>> tag.get('id', None)
367+
>>> tag['id'] != None
368+
True
368369
>>> tag['name']
369370
u'Free Trial'
370-
>>> tag.get('tagged_user_count', None)
371-
>>> tag['color']
372-
u'green'
371+
>>> tag['tagged_user_count']
372+
2
373373
374374
"""
375375

@@ -392,12 +392,12 @@ def update_tag(
392392
393393
>>> tag = Intercom.update_tag("Free Trial", "tag",
394394
... user_ids=["abc123", "def456"])
395-
>>> tag.get('id', None)
395+
>>> tag['id'] != None
396+
True
396397
>>> tag['name']
397398
u'Free Trial'
398-
>>> tag.get('tagged_user_count', None)
399-
>>> tag['color']
400-
u'green'
399+
>>> tag['tagged_user_count']
400+
2
401401
402402
"""
403403

@@ -417,12 +417,12 @@ def get_tag(cls, name=None):
417417
""" Return a dict for the tag by the specified name.
418418
419419
>>> tag = Intercom.get_tag(name="Free Trial")
420-
>>> tag.get('id', None)
420+
>>> tag['id'] != None
421+
True
421422
>>> tag['name']
422423
u'Free Trial'
423-
>>> tag.get('tagged_user_count', None)
424-
>>> tag['color']
425-
u'green'
424+
>>> tag['tagged_user_count']
425+
2
426426
427427
"""
428428

intercom/message_thread.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,13 @@ def reply(
8585
>>> message_thread = MessageThread.reply(email=email,
8686
... thread_id=thread_id, body=body)
8787
>>> len(message_thread.messages)
88-
2
88+
3
8989
>>> message_thread.messages[0].html
9090
u'<p>Hey Intercom, What is up?</p>\n\n<p></p>'
9191
>>> message_thread.messages[1].html
92-
u'<p>Are you talking to me?</p>'
92+
u'<p>Not much, you?\n</p>'
93+
>>> message_thread.messages[2].html
94+
u'<p>Not much either :(</p>\n\n<p></p>'
9395
9496
"""
9597
resp = Intercom.reply_message_thread(

intercom/tag.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ def find(cls, **params):
2424
""" Find a tag using params.
2525
2626
>>> tag = Tag.find(name="Free Trial")
27-
>>> tag.id
27+
>>> tag.id != None
28+
True
2829
>>> tag.name
2930
u'Free Trial'
3031
>>> tag.tagged_user_count
31-
>>> tag.color
32-
u'green'
32+
2
3333
3434
"""
3535
resp = Intercom.get_tag(**params)
@@ -40,12 +40,12 @@ def find_by_name(cls, name):
4040
""" Find a tag by name.
4141
4242
>>> tag = Tag.find_by_name("Free Trial")
43-
>>> tag.id
43+
>>> tag.id != None
44+
True
4445
>>> tag.name
4546
u'Free Trial'
4647
>>> tag.tagged_user_count
47-
>>> tag.color
48-
u'green'
48+
2
4949
5050
"""
5151
return Tag.find(name=name)
@@ -58,12 +58,12 @@ def create(
5858
5959
>>> tag = Tag.create(user_ids=["abc123", "def456"],
6060
... name="Free Trial", tag_or_untag="tag")
61-
>>> tag.id
61+
>>> tag.id != None
62+
True
6263
>>> tag.name
6364
u'Free Trial'
6465
>>> tag.tagged_user_count
65-
>>> tag.color
66-
u'green'
66+
2
6767
6868
"""
6969
resp = Intercom.create_tag(
@@ -80,8 +80,7 @@ def save(self):
8080
>>> tag.tag_or_untag = "tag"
8181
>>> tag.save()
8282
>>> tag.tagged_user_count
83-
>>> tag.color
84-
u'green'
83+
2
8584
8685
"""
8786
resp = Intercom.update_tag(

0 commit comments

Comments
 (0)