Commit 38537638 authored by Michal Čihař's avatar Michal Čihař

Improve test for user imports

Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent ce0cb287
......@@ -78,6 +78,18 @@ class CommandTest(TestCase):
call_command('importusers', get_test_file('users-django.json'))
self.assertEqual(User.objects.count(), 2)
def test_import_empty_users(self):
"""Test importing empty file"""
call_command('importusers', get_test_file('users-empty.json'))
# Only anonymous user
self.assertEqual(User.objects.count(), 1)
def test_import_invalud_users(self):
"""Test error handling in user import"""
call_command('importusers', get_test_file('users-invalid.json'))
# Only anonymous user
self.assertEqual(User.objects.count(), 1)
def test_userdata(self):
# Create test user
user = User.objects.create_user('testuser', 'test@example.com', 'x')
......
......@@ -15,7 +15,7 @@
],
"user_permissions": [],
"password": "!",
"email": "noreply@weblate.org",
"email": "weblate@example.org",
"date_joined": "2013-10-09T17:28:56.639"
}
}
......
[
{"email": "", "username": ""},
{"email": "noreply@weblate.org", "username": "duplicate"}
]
[{"first_name":"First","last_name":"Last","password":"x","email":"noreply@weblate.org","username":"weblate"}]
[{"first_name":"First","last_name":"Last","password":"x","email":"weblate@example.org","username":"weblate"}]
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment