Commits

hacklab  committed 95b4932

test for user with several names

  • Participants
  • Parent commits 1e2fa91
  • Branches namespaces

Comments (0)

Files changed (1)

File MoinMoin/_tests/test_user.py

 
 from MoinMoin import user
 from MoinMoin.util import crypto
+from MoinMoin.config import NAME
+from MoinMoin.items import Item
 
 
 class TestSimple(object):
         for test in cases:
             assert user.isValidName(test)
 
+class TestMultipleNames(object):
+
+    def test_single_name_is_chosen(self):
+        name = u"fu"
+        password = u"pass"
+        email = u"fu@example.org"
+        # first create a user
+        ret = user.create_user(name, password, email, validate=False)
+        item = Item.create(u'fu')
+        other = u'other'
+        item.meta[NAME].append(other)
+        item._save(item.meta)
+        # logging with two different names might be a controversial feature
+        # anyway, user.name must be a string and not a list
+        usr = user.User(name=name, password=password)
+        assert usr.name == name
+        alias = user.User(name=other, password=password)
+        assert usr.name == other
+
 
 coverage_modules = ['MoinMoin.user']