mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-17 05:41:25 +02:00
@@ -186,7 +186,7 @@ class Alias(AdminObject):
|
||||
sender="import", context=user, klass=Alias)
|
||||
core_signals.can_create_object.send(
|
||||
sender="import", context=domain, object_type="mailbox_aliases")
|
||||
if Alias.objects.filter(address=address).exists():
|
||||
if Alias.objects.filter(address=address, internal=False).exists():
|
||||
raise Conflict
|
||||
self.address = address
|
||||
self.domain = domain
|
||||
|
||||
@@ -83,7 +83,8 @@ domainalias;test.alias;test.com;True
|
||||
"sourcefile": f
|
||||
}
|
||||
)
|
||||
self.assertIn('Object already exists: domainalias', resp.content.decode())
|
||||
self.assertIn(
|
||||
"Object already exists: domainalias", resp.content.decode())
|
||||
|
||||
def test_identities_import(self):
|
||||
response = self.client.get(reverse("admin:identity_import"))
|
||||
@@ -274,3 +275,16 @@ alias;user.alias@test.com;True;user@test.com;;;;;;;;;;;;;;;;
|
||||
)
|
||||
alias = Alias.objects.get(address="user.alias@test.com")
|
||||
self.assertEqual(alias.type, "alias")
|
||||
|
||||
def test_import_account_alias_conflict(self):
|
||||
"""Specific test for #1144."""
|
||||
f = ContentFile(b"""
|
||||
alias;user@test.com;True;admin@test.com
|
||||
""", name="identities.csv")
|
||||
self.client.post(
|
||||
reverse("admin:identity_import"),
|
||||
{"sourcefile": f, "crypt_password": True}
|
||||
)
|
||||
self.assertTrue(
|
||||
Alias.objects.filter(
|
||||
address="user@test.com", internal=False).exists())
|
||||
|
||||
Reference in New Issue
Block a user