From a9626c697992fcd596726a4c16ba8c9757f6a0dd Mon Sep 17 00:00:00 2001 From: Jefferson Stachelski Date: Fri, 12 Feb 2016 17:58:45 -0200 Subject: attachments are only un-linked from emails but not deleted in soledad - removed backend delete of attachments - JS unit tests - Functional test Issue #549 --- service/test/functional/features/attachments.feature | 3 +++ service/test/functional/features/steps/attachments.py | 13 +++++++++++++ .../unit/adapter/mailstore/test_leap_attachment_store.py | 15 --------------- 3 files changed, 16 insertions(+), 15 deletions(-) (limited to 'service/test') diff --git a/service/test/functional/features/attachments.feature b/service/test/functional/features/attachments.feature index 5cdbf7be..7724596d 100644 --- a/service/test/functional/features/attachments.feature +++ b/service/test/functional/features/attachments.feature @@ -37,6 +37,9 @@ Feature: Attachments When I dismiss the error message Then It should not show the error message anymore When I upload a valid file + And remove the file + Then I should not see it attached + When I upload a valid file And I send it When I select the tag 'sent' And I open the first mail in the mail list diff --git a/service/test/functional/features/steps/attachments.py b/service/test/functional/features/steps/attachments.py index b0c7c791..76e42177 100644 --- a/service/test/functional/features/steps/attachments.py +++ b/service/test/functional/features/steps/attachments.py @@ -96,3 +96,16 @@ def upload_attachment(context): fill_by_css_selector(context, '#fileupload', base_dir + fname) attachment_list_item = wait_until_element_is_visible_by_locator(context, (By.CSS_SELECTOR, '#attachment-list-item li a')) assert attachment_list_item.text == "%s (36.00 b)" % fname + + +@when(u'remove the file') +def click_remove_icon(context): + remove_icon = wait_until_element_is_visible_by_locator(context, (By.CSS_SELECTOR, '#attachment-list-item i.remove-icon')) + remove_icon.click() + + +@then(u'I should not see it attached') +def assert_attachment_removed(context): + attachments_list_ul = find_elements_by_css_selector(context, '#attachment-list-item') + attachments_list_li = context.browser.find_elements(By.CSS_SELECTOR, '#attachment-list-item li a') + assert len(attachments_list_li) == 0 diff --git a/service/test/unit/adapter/mailstore/test_leap_attachment_store.py b/service/test/unit/adapter/mailstore/test_leap_attachment_store.py index f1bd8528..4e9b56b1 100644 --- a/service/test/unit/adapter/mailstore/test_leap_attachment_store.py +++ b/service/test/unit/adapter/mailstore/test_leap_attachment_store.py @@ -116,21 +116,6 @@ class TestLeapAttachmentStore(TestCase): except ValueError: pass - @defer.inlineCallbacks - def test_soledad_delete_doc_is_called_when_deleting_an_attachment(self): - attachment_id = '1B0A9AAD9E153D24265395203C53884506ABA276394B9FEC02B214BF9E77E48E' - doc = SoledadDocument(json=json.dumps({'content_type': 'foo/bar', 'raw': 'quoted-printable', - 'phash': attachment_id, - 'content_transfer_encoding': ''})) - - when(self.soledad).get_from_index('by-type-and-payloadhash', 'cnt', attachment_id).thenReturn(defer.succeed([doc])) - when(self.soledad).delete_doc(doc).thenReturn(defer.succeed(None)) - - store = LeapAttachmentStore(self.soledad) - yield store.delete_attachment(attachment_id) - - verify(self.soledad).delete_doc(doc) - def _mock_get_mailbox(self, mailbox_name, create_new_uuid=False): mbox_uuid = self.mbox_uuid if not create_new_uuid else str(uuid4()) when(self.soledad).list_indexes().thenReturn(defer.succeed(MAIL_INDEXES)).thenReturn( -- cgit v1.2.3