예제 #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)
예제 #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)
예제 #3
0
 def test_non_existent_token(self):
     email_text = self.email_template % (self.token.uuid + 'junk')
     assert not save_from_email_reply(email_text)
예제 #4
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)
예제 #5
0
 def test_reviewer_comment(self):
     self.grant_permission(self.profile, 'Apps:Review')
     note = save_from_email_reply(self.email_base64)
     eq_(note.note_type, comm.REVIEWER_COMMENT)
예제 #6
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)
예제 #7
0
 def test_non_existent_token(self):
     self.token.update(uuid='youtube?v=wn4RP57Y7bw')
     assert not save_from_email_reply(self.email_base64)
예제 #8
0
 def test_with_max_count_token(self):
     # Test with an invalid token.
     self.token.update(use_count=comm.MAX_TOKEN_USE_COUNT + 1)
     assert not save_from_email_reply(self.email_base64)
예제 #9
0
 def test_successful_save(self):
     email_text = self.email_template % self.token.uuid
     note = save_from_email_reply(email_text)
     assert note
     eq_(note.body, 'This is the body')
예제 #10
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.')
예제 #11
0
 def test_with_junk_body(self):
     email_text = 'this is junk'
     assert not save_from_email_reply(email_text)
예제 #12
0
 def test_non_existent_token(self):
     email_text = self.email_template % (self.token.uuid + 'junk')
     assert not save_from_email_reply(email_text)
예제 #13
0
 def test_with_max_count_token(self):
     # 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)
예제 #14
0
 def test_successful_save(self):
     email_text = self.email_template % self.token.uuid
     note = save_from_email_reply(email_text)
     assert note
     eq_(note.body, 'This is the body')
예제 #15
0
 def test_with_junk_body(self):
     email_text = 'this is junk'
     assert not save_from_email_reply(email_text)
예제 #16
0
 def test_successful_save(self):
     note = save_from_email_reply(self.email_base64)
     assert note
     eq_(note.body, 'test note 5\n')
예제 #17
0
 def test_with_max_count_token(self):
     # 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)
예제 #18
0
 def test_with_unpermitted_token(self):
     """Test when the token's user does not have a permission on thread."""
     self.profile.groupuser_set.filter(
         group__rules__contains='Apps:Review').delete()
     assert not save_from_email_reply(self.email_base64)
예제 #19
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.')
예제 #20
0
 def test_with_invalid_msg(self):
     assert not save_from_email_reply('youtube?v=WwJjts9FzxE')
예제 #21
0
 def test_developer_comment(self):
     self.profile.addonuser_set.create(addon=self.app)
     note = save_from_email_reply(self.email_base64)
     eq_(note.note_type, comm.DEVELOPER_COMMENT)