import pathlib

current = pathlib.Path(__file__).parent
root = current.parent

import sys
sys.path.append(str(root))

import assets

user_1 = assets.user("user", "password1", "APIKEY")

print("Sample user dump:")
print(user_1)
print()

user_factory = assets.user_factory()
user_factory.nick = "nick1"
user_factory.password = "password_a"

print("User from factory:")
print(user_factory.result)
print()

export = assets.user_exporter(user_factory.result).result

print("User export:")
print(export)
print()

builder = assets.user_builder(export)

print("User builded from export:")
print(builder.result)
print()

collection = assets.users_collection()

collection.add(user_1)
collection.add(user_factory.result)

print("User collection test:")
print("Login:")
print(collection.login("user", "password1"))
print(collection.login("nick1", "password_a"))
print("Get:")
print(collection.get(user_factory.result.apikey))
print("Get not found:")
print(collection.get("not_found"))
print("Login not found:")
print(collection.login("user", "pask"))