Beispiel #1
0
    def test_create_note_valid(self):
        note = Note.create(email='*****@*****.**')
        self.assertEqual("<p>This is the text of my note.</p>", note.html)

        # check params
        note = Note.create(email='*****@*****.**', body="home")
        self.assertEqual("<p>This is the text of my note.</p>", note.html)
Beispiel #2
0
    def test_create_note_valid(self):
        note = Note.create(email='*****@*****.**')
        self.assertEqual("<p>This is the text of my note.</p>", note.html)

        # check params
        note = Note.create(email='*****@*****.**', body="home")
        self.assertEqual("<p>This is the text of my note.</p>", note.html)
 def test_find_note(self):
     # Find a note by id
     orig_note = Note.create(
         body="<p>Text for the note</p>",
         email=self.email)
     note = Note.find(id=orig_note.id)
     self.assertEqual(note.body, orig_note.body)
Beispiel #4
0
    def test_properties(self):
        note = Note()
        note.body = 'xxx'
        note.email = '*****@*****.**'
        note.user_id = '123'

        self.assertEqual('xxx', note.body)
        self.assertEqual('*****@*****.**', note.email)
        self.assertEqual('123', note.user_id)
Beispiel #5
0
    def test_properties(self):
        note = Note()
        note.body = 'xxx'
        note.email = '*****@*****.**'
        note.user_id = '123'

        self.assertEqual('xxx', note.body)
        self.assertEqual('*****@*****.**', note.email)
        self.assertEqual('123', note.user_id)
Beispiel #6
0
def test_note():
    httpretty.register_uri(
        post, r(r"/v1/users/notes"),
        body=fixture('v1-users-note'))
    note = Note.create(body="This is a note", email='*****@*****.**')
    eq_(note.html, "<p>This is a note</p>")
    eq_(note.user.email, "*****@*****.**")
Beispiel #7
0
def test_note():
    httpretty.register_uri(post,
                           r(r"/v1/users/notes"),
                           body=fixture('v1-users-note'))
    note = Note.create(body="This is a note", email='*****@*****.**')
    eq_(note.html, "<p>This is a note</p>")
    eq_(note.user.email, "*****@*****.**")
 def test_find_all_email(self):
     # Iterate over all notes for a user via their email address
     notes = Note.find_all(email=self.email)
     for note in notes:
         self.assertTrue(note.id is not None)
         user = note.user.load()
         self.assertEqual(user.email, self.email)
         break
Beispiel #9
0
 def test_find_all_email(self):
     # Iterate over all notes for a user via their email address
     notes = Note.find_all(email=self.email)
     for note in notes:
         self.assertTrue(note.id is not None)
         user = note.user.load()
         self.assertEqual(user.email, self.email)
         break
Beispiel #10
0
    def test_find_all_id(self):
        from intercom.user import User
        user = User.find(email=self.email)

        # Iterate over all notes for a user via their email address
        for note in Note.find_all(user_id=user.user_id):
            self.assertTrue(note.id is not None)
            user = note.user.load()
            self.assertEqual(user.email, self.email)
Beispiel #11
0
    def test_find_all_id(self):
        from intercom.user import User
        user = User.find(email=self.email)

        # Iterate over all notes for a user via their email address
        for note in Note.find_all(user_id=user.user_id):
            self.assertTrue(note.id is not None)
            user = note.user.load()
            self.assertEqual(user.email, self.email)
Beispiel #12
0
 def it_creates_a_note(self):
     data = {
         'body': '<p>Note to leave on user</p>',
         'created_at': 1234567890
     }
     with patch.object(Intercom, 'post', return_value=data) as mock_method:
         note = Note.create(body="Note to leave on user")
         mock_method.assert_called_once_with(
             '/notes/', body="Note to leave on user")  # noqa
         eq_(note.body, "<p>Note to leave on user</p>")
Beispiel #13
0
def test_properties():
    note = Note()
    note.body = 'xxx'
    note.email = '*****@*****.**'
    note.user_id = '123'
    note.created_at = datetime.fromtimestamp(1331764344)

    eq_(note.body, 'xxx')
    eq_(note.email, '*****@*****.**')
    eq_(note.user_id, '123')
Beispiel #14
0
    def it_sets_gets_allowed_keys(self):
        params = {
            'body': 'Note body',
            'email': '*****@*****.**',
            'user_id': 'abc123'
        }
        params_keys = list(params.keys())
        params_keys.sort()

        note = Note(**params)
        note_dict = note.to_dict
        note_keys = list(note_dict.keys())
        note_keys.sort()

        eq_(params_keys, note_keys)
        for key in params_keys:
            eq_(getattr(note, key), params[key])
Beispiel #15
0
 def test_create_note_identifiers(self):
     Note.create()
Beispiel #16
0
 def test_create_note_identifiers(self):
     Note.create()
Beispiel #17
0
 def test_save(self):
     note = Note(email='*****@*****.**')
     note.save()
     self.assertEqual(None, note.created_at)
     self.assertEqual('123', note.user.user_id)
     self.assertEqual("<p>This is the text of my note.</p>", note.html)
Beispiel #18
0
 def test_find_note(self):
     # Find a note by id
     orig_note = Note.create(body="<p>Text for the note</p>",
                             email=self.email)
     note = Note.find(id=orig_note.id)
     self.assertEqual(note.body, orig_note.body)
Beispiel #19
0
 def test_create_note(self):
     # Create a note for a user
     note = Note.create(body="<p>Text for the note</p>", email=self.email)
     self.assertIsNotNone(note.id)
Beispiel #20
0
 def test_save(self):
     note = Note(email='*****@*****.**')
     note.save()        
     self.assertEqual("<p>This is the text of my note.</p>", note.html)
Beispiel #21
0
 def test_create_note(self):
     # Create a note for a user
     note = Note.create(
         body="<p>Text for the note</p>",
         email=self.email)
     self.assertIsNotNone(note.id)
Beispiel #22
0
 def test_save(self):
     note = Note(email='*****@*****.**')
     note.save()
     self.assertEqual(None, note.created_at)
     self.assertEqual('123', note.user.user_id)
     self.assertEqual("<p>This is the text of my note.</p>", note.html)
 def it_creates_a_note(self):
     data = {"body": "<p>Note to leave on user</p>", "created_at": 1234567890}
     with patch.object(Intercom, "post", return_value=data) as mock_method:
         note = Note.create(body="Note to leave on user")
         mock_method.assert_called_once_with("/notes/", body="Note to leave on user")  # noqa
         eq_(note.body, "<p>Note to leave on user</p>")