Beispiel #1
0
    def test_successful_save(self):
        self.grant_permission(self.profile, 'Apps:Review')
        email_text = self.email_template % self.token.uuid
        note = save_from_email_reply(email_text)
        assert note
        eq_(note.body, 'This is the body')

        # Test with an invalid token.
        self.token.update(use_count=comm.MAX_TOKEN_USE_COUNT + 1)
        email_text = self.email_template % self.token.uuid
        assert not save_from_email_reply(email_text)
Beispiel #2
0
    def test_successful_save(self):
        self.grant_permission(self.profile, 'Apps:Review')
        email_text = self.email_template % self.token.uuid
        note = save_from_email_reply(email_text)
        assert note
        eq_(note.body, 'This is the body')

        # Test with an invalid token.
        self.token.update(use_count=comm.MAX_TOKEN_USE_COUNT + 1)
        email_text = self.email_template % self.token.uuid
        assert not save_from_email_reply(email_text)
Beispiel #3
0
 def test_with_junk_body(self):
     email_text = 'this is junk'
     assert not save_from_email_reply(email_text)
Beispiel #4
0
 def test_non_existent_token(self):
     email_text = self.email_template % (self.token.uuid + 'junk')
     assert not save_from_email_reply(email_text)
Beispiel #5
0
 def test_with_unpermitted_token(self):
     """Test when the token's user does not have a permission on thread."""
     email_text = self.email_template % self.token.uuid
     assert not save_from_email_reply(email_text)
Beispiel #6
0
 def test_successful_save(self):
     self.grant_permission(self.profile, 'Apps:Review')
     email_text = self.email_template % self.token.uuid
     note = save_from_email_reply(email_text)
     assert note
     eq_(note.body, 'This is the body')
Beispiel #7
0
def consume_email(email_text, **kwargs):
    """Parse emails and save notes."""
    res = save_from_email_reply(email_text)
    if not res:
        log.error('Failed to save email.')
Beispiel #8
0
 def test_with_junk_body(self):
     email_text = 'this is junk'
     assert not save_from_email_reply(email_text)
Beispiel #9
0
 def test_non_existent_token(self):
     email_text = self.email_template % (self.token.uuid + 'junk')
     assert not save_from_email_reply(email_text)
Beispiel #10
0
 def test_with_unpermitted_token(self):
     """Test when the token's user does not have a permission on thread."""
     email_text = self.email_template % self.token.uuid
     assert not save_from_email_reply(email_text)