import pytest
import os
from src import testlogger
from src import webservice
from src.setup import Setup_Library
from src import utils
from config import fwork
from src.dataReader import data

admin_data = data().get_data("hr_admin")

logger = testlogger.setup_custom_logger('ewa_admin')
setup_test = Setup_Library()
admin_token = setup_test.get_admin_token()
base_url = setup_test.data.login.base_url
apis = setup_test.data.apis
hr_token = setup_test.get_employee_token()


class TestHrAdminData(object):

    # schemas
    admin_schema = os.path.join(fwork.IN_DATA_PATH,
                                admin_data.get('hr_admin_data_schema'))

    def test_EWA_6069_validate_groups_schema(self):
        logger.debug('HR Admin Data: test_validate_get_schema')
        response = webservice.get(url=base_url + apis.hr_admin_data_endpoint,
                                  token=hr_token)
        logger.debug('HR Admin Data: Validating json schema')
        utils.assert_valid_schema(response.json(),
import pytest
import os
import json
from src import testlogger
from src import webservice
from src.setup import Setup_Library
from src import utils
from config import fwork
from src.dataReader import data
# TO DO hardcoded to qa need to be made flexible
permissions_data = data().get_data("permissions_qa")

logger = testlogger.setup_custom_logger('ewa_admin')
setup_test = Setup_Library()

# @pytest.fixture
# def admin_token():
#     token = setup_test.get_admin_token()
#     logger.debug("Token value %s" % (token))
#     return token

import pytest
import os
from src import testlogger
from src import webservice
from src.setup import Setup_Library
from src import utils
from src import roles_helper
from config import fwork
from src.dataReader import data
import json

logger = testlogger.setup_custom_logger('ewa_admin')
setup_test = Setup_Library()
roles_data = data().get_data("roles")
base_url = setup_test.data.login.base_url
apis = setup_test.data.apis
admin_token = setup_test.get_admin_token()
non_admin_token = setup_test.get_employee_token()


class TestRolesApi(object):
    """
            Fixtures for the Roles test

    """
    roles_schema = os.path.join(fwork.IN_DATA_PATH,
                                roles_data.get('roles_list_schema'))

    @pytest.fixture(scope='class')
    def delete_after_add_role(self, request):
        roles_added = []
Esempio n. 4
0
from src.dataReader import data
from src.setup import Setup_Library
from src import testlogger
import webservice

roles_data = data().get_data('roles')
setup_test = Setup_Library()
apis = setup_test.data.apis
base_url = setup_test.data.login.base_url
admin_token = setup_test.get_admin_token()
hr_token = setup_test.get_employee_token()
logger = testlogger.setup_custom_logger('ewa_admin')


def get_group_list():
    logger.debug('group List: Get group List')
    response = webservice.get(url=base_url + apis.group_list_endpoint,
                              token=admin_token)
    logger.debug('Groups: Validating json schema')
    response_data = response.json()
    group_id_list = response_data['groups']
    return group_id_list


def generate_role_data():
    new_role_data = roles_data.get('add_new_role')
    logger.debug(new_role_data)
    new_role_data['roleName'] = 'AddingroleFromAutomation'
    new_role_data['roleDescription'] = 'Automation group Test Case'
    group_dict = get_group_list()[0]
    new_role_data['roleGroup'] = str(group_dict['groupId'])
Esempio n. 5
0
import pytest
import os
import json
from src import testlogger
from src import webservice
from src import employee_api_helper
from src.setup import Setup_Library
from src import utils
from config import fwork
from src.dataReader import data
import random

employee_basic_data = data().get_data("employee_basic")

logger = testlogger.setup_custom_logger('ewa_admin')
setup_test = Setup_Library()
admin_token = setup_test.get_admin_token()
hr_token = setup_test.get_employee_token()
base_url = setup_test.data.login.base_url
apis = setup_test.data.apis


class TestEmployeeBasicData(object):
    @pytest.fixture(scope='class')
    def delete_user(self, request):
        users_added = []

        def cleanup():
            for email in users_added:
                remove_user = apis.remove_user_endpoint + email
                webservice.delete(url=base_url + remove_user,
Esempio n. 6
0
import pytest
import os
from src import testlogger
from src import webservice
from src.setup import Setup_Library
from src import utils
from config import fwork
from src.dataReader import data
import json

logger = testlogger.setup_custom_logger('ewa_admin')
setup_test = Setup_Library()
groups_data = data().get_data("groups")
base_url = setup_test.data.login.base_url
apis = setup_test.data.apis
admin_token = setup_test.get_admin_token()


class TestGroupsApi(object):
    """
            Fixtures for the Groups test

    """
    # schemas
    group_schema = os.path.join(fwork.IN_DATA_PATH, groups_data.get('groups_list_schema'))

    @pytest.fixture(scope='class')
    def delete_after_add_group(self, request):
        groups_added = []

        def cleanup():
import sys
import os

from src.dataReader import data
from config import fwork
import src.webservice

dat = data()
data().create_data()


class Setup_Library(object):
    def __init__(self):
        if os.getenv('DEV') == 'dev':
            self.data = dat.get_data('topo_dev')
        elif os.getenv('QA') == 'qa':
            self.data = dat.get_data('topo_qa')
        self.admin_token = self.fetch_token(self.data.get('admin'))
        self.employee_token = self.fetch_token(self.data.get('employee'))

    def fetch_token(self, login_values=None, email=None, password=None):
        if login_values:
            email = login_values['email']
            password = login_values['password']

        token = src.webservice.get_token(
            self.data.get('login').get('base_url') + 'login', email, password)
        return token

    def get_admin_token(self):
        """
Esempio n. 8
0
import random
from src.dataReader import data
from datetime import datetime
from src.setup import Setup_Library
from src import testlogger
import webservice
import utils
import json

employee_data = data().get_data('employee_basic')
setup_test = Setup_Library()
apis = setup_test.data.apis
base_url = setup_test.data.login.base_url
admin_token = setup_test.get_admin_token()
hr_token = setup_test.get_employee_token()
logger = testlogger.setup_custom_logger('ewa_admin')

# firstName: Test
#     lastName:  Automation
#     dateOfBirth: 01-01-1970
#     fatherName: Senion Automation
#     sex: Female
#     designation: Automation Engineer
#     selectedGrade:
#     dateOfJoining: 02-02-2015
#     selectedGroups: [Groups1, Groups2]
#     jobLocation: Noida
#     reportingManager: [email protected]
#     reportingManagerHR: [email protected]
#     reportingManagerFinance: [email protected]
#     emailId: [email protected]
from src import testlogger
from src import webservice
from src.setup import Setup_Library
from src import utils
from config import fwork
from src.dataReader import data
import json
import pytest

logger = testlogger.setup_custom_logger('ewa_admin')
setup_test = Setup_Library()
admin_token = setup_test.get_admin_token()
base_url = setup_test.data.login.base_url
apis = setup_test.data.apis

grades_data = data().get_data("grades")


class TestGradesApi(object):
    """
            Fixtures for the Grades test


    """

    # schemas
    grades_schema = os.path.join(fwork.IN_DATA_PATH,
                                 grades_data.get('grades_list_schema'))

    @pytest.fixture(scope='class')
    def delete_after_add_grade(self, request):