-
Notifications
You must be signed in to change notification settings - Fork 368
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
孙永强
committed
Aug 15, 2024
1 parent
aba4e22
commit b0c453f
Showing
1 changed file
with
8 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,11 +35,11 @@ def test_can_send_email_configured(self): | |
|
||
resp = self.client.post(url, data) | ||
self.assertEqual(200, resp.status_code) | ||
self.assertEqual(len(mail.outbox), 1) | ||
self.assertEqual(len(mail.outbox), 2) | ||
json_resp = json.loads(resp.content) | ||
assert json_resp['success'][0] == self.admin.email | ||
assert json_resp['failed'][0]['email'] == invalid_email | ||
assert mail.outbox[0].from_email == '[email protected]' | ||
assert mail.outbox[1].from_email == '[email protected]' | ||
|
||
@patch('seahub.utils.IS_EMAIL_CONFIGURED', True) | ||
@patch('seahub.api2.endpoints.send_upload_link_email.IS_EMAIL_CONFIGURED', True) | ||
|
@@ -54,10 +54,10 @@ def test_can_send_email_rewrite(self): | |
|
||
resp = self.client.post(url, data) | ||
self.assertEqual(200, resp.status_code) | ||
self.assertEqual(len(mail.outbox), 1) | ||
self.assertEqual(len(mail.outbox), 2) | ||
json_resp = json.loads(resp.content) | ||
assert json_resp['success'][0] == self.admin.email | ||
assert mail.outbox[0].extra_headers['Reply-to'] == self.user.email | ||
assert mail.outbox[1].extra_headers['Reply-to'] == self.user.email | ||
|
||
@patch('seahub.utils.IS_EMAIL_CONFIGURED', True) | ||
@patch('seahub.api2.endpoints.send_upload_link_email.IS_EMAIL_CONFIGURED', True) | ||
|
@@ -80,10 +80,10 @@ def test_can_send_email_rewrite_contact_email(self): | |
|
||
resp = self.client.post(url, data) | ||
self.assertEqual(200, resp.status_code) | ||
self.assertEqual(len(mail.outbox), 1) | ||
self.assertEqual(len(mail.outbox), 2) | ||
json_resp = json.loads(resp.content) | ||
assert json_resp['success'][0] == self.admin.email | ||
assert mail.outbox[0].extra_headers['Reply-to'] == contact_email | ||
assert mail.outbox[1].extra_headers['Reply-to'] == contact_email | ||
|
||
@patch('seahub.utils.IS_EMAIL_CONFIGURED', False) | ||
@patch('seahub.api2.endpoints.send_upload_link_email.IS_EMAIL_CONFIGURED', False) | ||
|
@@ -98,7 +98,7 @@ def test_can_send_email_not_configured(self): | |
|
||
resp = self.client.post(url, data) | ||
self.assertEqual(403, resp.status_code) | ||
self.assertEqual(len(mail.outbox), 0) | ||
self.assertEqual(len(mail.outbox), 1) | ||
|
||
def test_can_not_send_email_if_not_link_owner(self): | ||
self.login_as(self.admin) | ||
|
@@ -110,4 +110,4 @@ def test_can_not_send_email_if_not_link_owner(self): | |
|
||
resp = self.client.post(url, data) | ||
self.assertEqual(403, resp.status_code) | ||
self.assertEqual(len(mail.outbox), 0) | ||
self.assertEqual(len(mail.outbox), 1) |