Permalink
Browse files

Test command for users import

  • Loading branch information...
1 parent fabd580 commit 19ac076c593ab6a2f4036952afa24e98178e9ee7 @nijel nijel committed May 7, 2013
Showing with 14 additions and 0 deletions.
  1. +13 −0 accounts/tests.py
  2. +1 −0 trans/tests/data/users.json
View
@@ -39,6 +39,7 @@
)
from trans.tests.views import ViewTestCase
+from trans.tests.util import get_test_file
from trans.models.unitdata import Suggestion, Comment
from lang.models import Language
@@ -150,6 +151,18 @@ def test_setupgroups(self):
)
call_command('setupgroups', move=True)
+ def test_importusers(self):
+ # First import
+ call_command('importusers', get_test_file('users.json'))
+
+ # Test that second import does not change anything
+ user = User.objects.get(username='weblate')
+ user.first_name = 'Weblate test user'
+ user.save()
+ call_command('importusers', get_test_file('users.json'))
+ user2 = User.objects.get(username='weblate')
+ self.assertEquals(user.first_name, user2.first_name)
+
class ViewTest(TestCase):
'''
@@ -0,0 +1 @@
+[{"first_name":"First","last_name":"Last","password":"x","email":"noreply@weblate.org","username":"weblate"}]

0 comments on commit 19ac076

Please sign in to comment.