File tree Expand file tree Collapse file tree 2 files changed +43
-1
lines changed Expand file tree Collapse file tree 2 files changed +43
-1
lines changed Original file line number Diff line number Diff line change 1
1
from intercom .user import Resource
2
2
from intercom .api_operations .find import Find
3
+ from intercom .api_operations .save import Save
3
4
4
5
5
- class Note (Resource , Find ):
6
+ class Note (Resource , Find , Save ):
6
7
pass
Original file line number Diff line number Diff line change
1
+ import httpretty
2
+ import json
3
+ import re
4
+ from describe import expect
5
+ from intercom .note import Note
6
+
7
+ post = httpretty .POST
8
+ r = re .compile
9
+
10
+
11
+ class DescribeIntercomNote :
12
+
13
+ @httpretty .activate
14
+ def it_creates_a_note (self ):
15
+ data = {
16
+ 'body' : '<p>Note to leave on user</p>' ,
17
+ 'created_at' : 1234567890
18
+ }
19
+ httpretty .register_uri (
20
+ post , r (r'/notes/$' ), body = json .dumps (data ))
21
+ note = Note .create (body = "Note to leave on user" )
22
+ expect (note .body ) == "<p>Note to leave on user</p>"
23
+
24
+ @httpretty .activate
25
+ def it_sets_gets_allowed_keys (self ):
26
+ params = {
27
+ 'body' : 'Note body' ,
28
+ 'email' : 'me@example.com' ,
29
+ 'user_id' : 'abc123'
30
+ }
31
+ params_keys = params .keys ()
32
+ params_keys .sort ()
33
+
34
+ note = Note (** params )
35
+ note_dict = note .to_dict
36
+ note_keys = note_dict .keys ()
37
+ note_keys .sort ()
38
+
39
+ expect (params_keys ) == note_keys
40
+ for key in params_keys :
41
+ expect (getattr (note , key )) == params [key ]
You can’t perform that action at this time.
0 commit comments