#!/usr/bin/env python
# -*- coding: utf-8 -*-
from testrail_yak import User
from testrail_yak.lib.testrail import APIClient
from tests import BASEURL, reqmock


client = APIClient(BASEURL)
u = User(client)


def test_get(reqmock):
    user_id = 1
    reqmock.get(f"{BASEURL}/index.php?/api/v2/get_user/{user_id}",
        status_code=200,
        text='''{
            "email": "alexis@example.com",
            "id": 1,
            "is_active": true,
            "name": "Alexis Gonzalez"
        }''')

    res = u.get(user_id=user_id)
    assert res is not None
    assert type(res) == dict
    assert "email" in res.keys()
    assert "id" in res.keys()
    assert "is_active" in res.keys()
    assert "name" in res.keys()


def test_get_by_email(reqmock):
    email = "alexis@example.com"
    reqmock.get(f"{BASEURL}/index.php?/api/v2/get_user_by_email&email={email}",
        status_code=200,
        text='''{
            "email": "alexis@example.com",
            "id": 1,
            "is_active": true,
            "name": "Alexis Gonzalez"
        }''')

    res = u.get_by_email(email_addr=email)
    assert res is not None
    assert type(res) == dict
    assert "email" in res.keys()
    assert res["email"] == email


def test_get_all(reqmock):
    reqmock.get(f"{BASEURL}/index.php?/api/v2/get_users",
        status_code=200,
        text='''[{
            "email": "alexis@example.com",
            "id": 1,
            "is_active": true,
            "name": "Alexis Gonzalez"
        }]''')

    res = u.get_all()
    assert res is not None
    assert type(res) == list
    assert type(res[0]) == dict

5499e5b3c925ac94e8a5e2b7c3be5b1f89929b83
<mask token>


def test_get(reqmock):
    user_id = 1
    reqmock.get(f'{BASEURL}/index.php?/api/v2/get_user/{user_id}',
        status_code=200, text=
        """{
            "email": "alexis@example.com",
            "id": 1,
            "is_active": true,
            "name": "Alexis Gonzalez"
        }"""
        )
    res = u.get(user_id=user_id)
    assert res is not None
    assert type(res) == dict
    assert 'email' in res.keys()
    assert 'id' in res.keys()
    assert 'is_active' in res.keys()
    assert 'name' in res.keys()


def test_get_by_email(reqmock):
    email = 'alexis@example.com'
    reqmock.get(f'{BASEURL}/index.php?/api/v2/get_user_by_email&email={email}',
        status_code=200, text=
        """{
            "email": "alexis@example.com",
            "id": 1,
            "is_active": true,
            "name": "Alexis Gonzalez"
        }"""
        )
    res = u.get_by_email(email_addr=email)
    assert res is not None
    assert type(res) == dict
    assert 'email' in res.keys()
    assert res['email'] == email


<mask token>

<mask token>


def test_get(reqmock):
    user_id = 1
    reqmock.get(f'{BASEURL}/index.php?/api/v2/get_user/{user_id}',
        status_code=200, text=
        """{
            "email": "alexis@example.com",
            "id": 1,
            "is_active": true,
            "name": "Alexis Gonzalez"
        }"""
        )
    res = u.get(user_id=user_id)
    assert res is not None
    assert type(res) == dict
    assert 'email' in res.keys()
    assert 'id' in res.keys()
    assert 'is_active' in res.keys()
    assert 'name' in res.keys()


def test_get_by_email(reqmock):
    email = 'alexis@example.com'
    reqmock.get(f'{BASEURL}/index.php?/api/v2/get_user_by_email&email={email}',
        status_code=200, text=
        """{
            "email": "alexis@example.com",
            "id": 1,
            "is_active": true,
            "name": "Alexis Gonzalez"
        }"""
        )
    res = u.get_by_email(email_addr=email)
    assert res is not None
    assert type(res) == dict
    assert 'email' in res.keys()
    assert res['email'] == email


def test_get_all(reqmock):
    reqmock.get(f'{BASEURL}/index.php?/api/v2/get_users', status_code=200,
        text=
        """[{
            "email": "alexis@example.com",
            "id": 1,
            "is_active": true,
            "name": "Alexis Gonzalez"
        }]"""
        )
    res = u.get_all()
    assert res is not None
    assert type(res) == list
    assert type(res[0]) == dict

<mask token>
client = APIClient(BASEURL)
u = User(client)


def test_get(reqmock):
    user_id = 1
    reqmock.get(f'{BASEURL}/index.php?/api/v2/get_user/{user_id}',
        status_code=200, text=
        """{
            "email": "alexis@example.com",
            "id": 1,
            "is_active": true,
            "name": "Alexis Gonzalez"
        }"""
        )
    res = u.get(user_id=user_id)
    assert res is not None
    assert type(res) == dict
    assert 'email' in res.keys()
    assert 'id' in res.keys()
    assert 'is_active' in res.keys()
    assert 'name' in res.keys()


def test_get_by_email(reqmock):
    email = 'alexis@example.com'
    reqmock.get(f'{BASEURL}/index.php?/api/v2/get_user_by_email&email={email}',
        status_code=200, text=
        """{
            "email": "alexis@example.com",
            "id": 1,
            "is_active": true,
            "name": "Alexis Gonzalez"
        }"""
        )
    res = u.get_by_email(email_addr=email)
    assert res is not None
    assert type(res) == dict
    assert 'email' in res.keys()
    assert res['email'] == email


def test_get_all(reqmock):
    reqmock.get(f'{BASEURL}/index.php?/api/v2/get_users', status_code=200,
        text=
        """[{
            "email": "alexis@example.com",
            "id": 1,
            "is_active": true,
            "name": "Alexis Gonzalez"
        }]"""
        )
    res = u.get_all()
    assert res is not None
    assert type(res) == list
    assert type(res[0]) == dict

from testrail_yak import User
from testrail_yak.lib.testrail import APIClient
from tests import BASEURL, reqmock
client = APIClient(BASEURL)
u = User(client)


def test_get(reqmock):
    user_id = 1
    reqmock.get(f'{BASEURL}/index.php?/api/v2/get_user/{user_id}',
        status_code=200, text=
        """{
            "email": "alexis@example.com",
            "id": 1,
            "is_active": true,
            "name": "Alexis Gonzalez"
        }"""
        )
    res = u.get(user_id=user_id)
    assert res is not None
    assert type(res) == dict
    assert 'email' in res.keys()
    assert 'id' in res.keys()
    assert 'is_active' in res.keys()
    assert 'name' in res.keys()


def test_get_by_email(reqmock):
    email = 'alexis@example.com'
    reqmock.get(f'{BASEURL}/index.php?/api/v2/get_user_by_email&email={email}',
        status_code=200, text=
        """{
            "email": "alexis@example.com",
            "id": 1,
            "is_active": true,
            "name": "Alexis Gonzalez"
        }"""
        )
    res = u.get_by_email(email_addr=email)
    assert res is not None
    assert type(res) == dict
    assert 'email' in res.keys()
    assert res['email'] == email


def test_get_all(reqmock):
    reqmock.get(f'{BASEURL}/index.php?/api/v2/get_users', status_code=200,
        text=
        """[{
            "email": "alexis@example.com",
            "id": 1,
            "is_active": true,
            "name": "Alexis Gonzalez"
        }]"""
        )
    res = u.get_all()
    assert res is not None
    assert type(res) == list
    assert type(res[0]) == dict

#!/usr/bin/env python
# -*- coding: utf-8 -*-
from testrail_yak import User
from testrail_yak.lib.testrail import APIClient
from tests import BASEURL, reqmock


client = APIClient(BASEURL)
u = User(client)


def test_get(reqmock):
    user_id = 1
    reqmock.get(f"{BASEURL}/index.php?/api/v2/get_user/{user_id}",
        status_code=200,
        text='''{
            "email": "alexis@example.com",
            "id": 1,
            "is_active": true,
            "name": "Alexis Gonzalez"
        }''')

    res = u.get(user_id=user_id)
    assert res is not None
    assert type(res) == dict
    assert "email" in res.keys()
    assert "id" in res.keys()
    assert "is_active" in res.keys()
    assert "name" in res.keys()


def test_get_by_email(reqmock):
    email = "alexis@example.com"
    reqmock.get(f"{BASEURL}/index.php?/api/v2/get_user_by_email&email={email}",
        status_code=200,
        text='''{
            "email": "alexis@example.com",
            "id": 1,
            "is_active": true,
            "name": "Alexis Gonzalez"
        }''')

    res = u.get_by_email(email_addr=email)
    assert res is not None
    assert type(res) == dict
    assert "email" in res.keys()
    assert res["email"] == email


def test_get_all(reqmock):
    reqmock.get(f"{BASEURL}/index.php?/api/v2/get_users",
        status_code=200,
        text='''[{
            "email": "alexis@example.com",
            "id": 1,
            "is_active": true,
            "name": "Alexis Gonzalez"
        }]''')

    res = u.get_all()
    assert res is not None
    assert type(res) == list
    assert type(res[0]) == dict
