def test_create_tenant_fail_for_existing_domain(rs_json=None):
    # get existing domain from DB
    tenant_dao = TenantsDAO()
    existing_tenant = tenant_dao.get_random_tenant_from_db()
    existing_domain = existing_tenant[0]['domain']
    existing_name = existing_tenant[0]['name']

    # make API call
    tenant_object = RequestUtility()
    payload = {
        'domain': existing_domain,
        'admin': 2,
        'admin_name': 'adiAdmin',
        'name': existing_name
    }

    tenant_api_info = tenant_object.post(endpoint='api/tenants/tenant/',
                                         payload=payload,
                                         expected_status_code=400)

    # verify the response
    error_message = "['Client with this Subdomain already exists.']"

    assert str(tenant_api_info['domain']) == error_message, f"Expected: {error_message}" \
                                                            f" Actual: {str(tenant_api_info['domain'])} "
def test_create_user_fail_for_existing_email(rs_json=None):
    # get existing email from DB
    user_dao = UsersDAO()
    existing_user = user_dao.get_random_user_from_db()
    existing_email = existing_user[0]['email']
    existing_nick = existing_user[0]['nick_name']
    existing_calendar_url = existing_user[0]['calendar_url']
    existing_mfa = existing_user[0]['mfa_enabled']

    # make API call
    user_object = RequestUtility()
    payload = {'email': existing_email, 'nick_name': existing_nick, 'roles': ['tenant_user'],
               'mfa_enabled': existing_mfa, 'first_name': 'First User', 'last_name': 'Last', 'username': existing_email,
               'calendar_url': existing_calendar_url}
    user_api_info = user_object.post(endpoint='api/users/user/', payload=payload, expected_status_code=400)

    # verify the response
    error_message = "['This field must be unique.']"

    assert str(user_api_info['email']) == error_message, f"Expected: 'This field must be unique.' Actual: " \
                                                         f"{str(user_api_info['email'])} "
    # pdb.set_trace()


    #test test test
Example #3
0
def test_get_all_invoices():
    logger.info('Fetch and display all existing invoices: ')
    req_helper = RequestUtility()
    rs_api = req_helper.get('api/boast_invoicing/invoices/')

    assert rs_api, f"Response of the list 'all invoices' is empty."

    pdb.set_trace()
Example #4
0
def test_get_all_tenants():
    logger.info('Fetch and display all boast tenants: ')
    req_helper = RequestUtility()
    rs_api = req_helper.get('api/tenants/tenant/')

    assert rs_api, f"Response of the list 'all tenants' is empty."
Example #5
0
def test_get_all_users():
    logger.info('Fetch and display all boast users: ')
    req_helper = RequestUtility()
    rs_api = req_helper.get('api/users/user/')

    assert rs_api, f"Response of the list 'all users' is empty. "
Example #6
0
 def __init__(self):
     self.request_utility = RequestUtility()
Example #7
0
def test_get_all_logs():
    logger.info('Fetch and display all boast logs: ')
    req_helper = RequestUtility()
    rs_api = req_helper.get('api/apputils/backgroundtask/')

    assert rs_api, f"Response of the list 'all logs' is empty. "