Skip to content
Snippets Groups Projects
Commit 3c71e098 authored by Quazgar's avatar Quazgar Committed by Henrik tom Wörden
Browse files

F test insert test user

parent cc953b8f
Branches
Tags
No related merge requests found
......@@ -27,9 +27,12 @@
"""
from __future__ import absolute_import
from nose.tools import assert_true, assert_equal, assert_raises, assert_false, assert_is_none, assert_is_not_none, nottest, with_setup # @UnresolvedImport
from pytest import raises
import caosdb as db
from nose.tools import (assert_true, assert_equal, assert_raises, assert_false,
assert_is_none, assert_is_not_none, nottest,
with_setup) # @UnresolvedImport
from pytest import raises
from nose.tools import (assert_equal, assert_false, # @UnresolvedImport
assert_is_none, assert_is_not_none, assert_raises,
assert_true, nottest, with_setup)
......@@ -39,6 +42,7 @@ from .test_misc import test_info
test_user = "test_user"
test_role = "test_role"
test_pw = "passphrase1P!"
easy_pw = "1234"
def setup_module():
......@@ -100,7 +104,7 @@ def grant_permission(entity, permission, username=test_user, priority=False,
return ret
@nottest
@nottest # No need to test manually, is called by setup()
def insert_test_user():
try:
db.administration._delete_user(name=test_user)
......@@ -111,6 +115,14 @@ def insert_test_user():
except BaseException:
pass
with assert_raises(db.ClientErrorException) as cee:
db.administration._insert_user(
name=test_user,
password=easy_pw,
status="ACTIVE")
assert_equal(cee.exception.status, 422,
"Easy password should raise a 422 error.")
db.administration._insert_user(
name=test_user,
password=test_pw,
......
......@@ -615,7 +615,7 @@ def test_ticket_39():
upload_file.close()
# check if the server can connect to this filesystem
f = db.File(path="testfiles/file1", from_location=testfile).insert()
f = db.File(path="testfiles/file1", pickup=testfile).insert()
assert_true(f.is_valid())
f.delete()
......@@ -623,7 +623,7 @@ def test_ticket_39():
os.chmod(testfile, 0o000)
try:
f = db.File(
path="testfiles/file1", from_location=testfile).insert()
path="testfiles/file1", pickup=testfile).insert()
except EntityError as e:
assert_equal(
"Insufficient read permission for this file. "
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment