Skip to content
This repository has been archived by the owner on Aug 5, 2024. It is now read-only.

Commit

Permalink
fix: Make userDB global to keep pytest happy
Browse files Browse the repository at this point in the history
  • Loading branch information
rsavoye committed Dec 18, 2023
1 parent 105b378 commit 4a42df4
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions tests/test_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,39 +39,41 @@
# FIXME: For now these tests assume you have a local postgres installed. One has the TM
# database, the other for tm_admin.

def test_all(user):
user = UsersDB('localhost/tm_admin')

def test_all():
all = user.getAll()
assert len(all) > 0

def test_by_id(user):
def test_by_id():
id = 4606673
all = user.getByID(id)
assert len(all) > 0

def test_by_name(user):
def test_by_name():
name = 'rsavoye'
all = user.getByName(name)
assert len(all) > 0

def test_role(user):
def test_role():
id = 4606673
role = Userrole(1)
result = user.updateRole(id, role)
assert result

def test_level(user):
def test_level():
id = 4606673
level = Mappinglevel(1)
result = user.updateMappingLevel(id, level)
assert result

def test_expert(user):
def test_expert():
id = 4606673
mode = True
result = user.updateColumn(id, {'is_expert': mode})
assert result

def test_registered(user):
def test_registered():
start = '2020-11-20 08:36:55'
stime = datetime.strptime(start, '%Y-%m-%d %H:%M:%S')
end = '2023-02-07 12:28:30'
Expand All @@ -97,7 +99,7 @@ def test_registered(user):
stream=sys.stdout,
)

user = UsersDB(args.uri)
# user = UsersDB(args.uri)

print("--- test_by_id() ---")
test_by_id(user)
Expand Down

0 comments on commit 4a42df4

Please sign in to comment.