summaryrefslogtreecommitdiff
path: root/tools/python_test.py
diff options
context:
space:
mode:
authorRichard Hansen <rhansen@rhansen.org>2016-02-11 22:50:28 -0500
committerRichard Hansen <rhansen@rhansen.org>2016-02-12 02:40:58 -0500
commit8f59516a4d7d5c6c654e8c2531092e217d13a4be (patch)
treefdeea2dbb3e238f646774abcc8224da3bb11bc3a /tools/python_test.py
parent01802c0ceb7c677ea0eb9c6a1b2382048b9fed86 (diff)
downloadgitlab-8f59516a4d7d5c6c654e8c2531092e217d13a4be.tar.gz
define UserManager.search() to search for users
Diffstat (limited to 'tools/python_test.py')
-rw-r--r--tools/python_test.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/python_test.py b/tools/python_test.py
index aa881b1..a2e0b15 100644
--- a/tools/python_test.py
+++ b/tools/python_test.py
@@ -43,12 +43,24 @@ assert(new_user.email == user.email)
new_user.block()
new_user.unblock()
+foobar_user = gl.users.create(
+ {'email': 'foobar@example.com', 'username': 'foobar',
+ 'name': 'Foo Bar', 'password': 'foobar_password'})
+
+assert gl.users.search('foobar') == [foobar_user]
+usercmp = lambda x,y: cmp(x.id, y.id)
+expected = sorted([new_user, foobar_user], cmp=usercmp)
+actual = sorted(gl.users.search('foo'), cmp=usercmp)
+assert expected == actual
+assert gl.users.search('asdf') == []
+
# SSH keys
key = new_user.keys.create({'title': 'testkey', 'key': SSH_KEY})
assert(len(new_user.keys.list()) == 1)
key.delete()
new_user.delete()
+foobar_user.delete()
assert(len(gl.users.list()) == 1)
# current user key