def test_post_sm_contexts(self):
        """Test case for post_sm_contexts

        Create SM Context
        """
        body = Body()
        response = self.client.open('/sm-contexts',
                                    method='POST',
                                    data=json.dumps(body),
                                    content_type='multipart/related')
        self.assert200(response,
                       'Response body is : ' + response.data.decode('utf-8'))
示例#2
0
    def test_app_naive_forecast(self):
        """Test case for app_naive_forecast

        
        """
        body = Body()
        response = self.client.open('/forecast',
                                    method='POST',
                                    data=json.dumps(body),
                                    content_type='application/json')
        self.assert200(response,
                       'Response body is : ' + response.data.decode('utf-8'))
    def test_reactions_post(self):
        """Test case for reactions_post

        Réagir avec une emoji à un message
        """
        body = Body()
        response = self.client.open('/reactions',
                                    method='POST',
                                    data=json.dumps(body),
                                    content_type='application/json')
        self.assert200(response,
                       'Response body is : ' + response.data.decode('utf-8'))
示例#4
0
    def test_towdata_put(self):
        """Test case for towdata_put

        Uploads live data to the server for predicition
        """
        body = Body()
        response = self.client.open('/towdata',
                                    method='PUT',
                                    data=json.dumps(body),
                                    content_type='application/json')
        self.assert200(response,
                       'Response body is : ' + response.data.decode('utf-8'))
示例#5
0
    def test_search_post(self):
        """Test case for search_post

        Search over Datamarts
        """
        body = Body()
        response = self.client.open('/search',
                                    method='POST',
                                    data=json.dumps(body),
                                    content_type='application/json')
        self.assert200(response,
                       'Response body is : ' + response.data.decode('utf-8'))
    def test_add_article(self):
        """Test case for add_article

        Создать новую статью
        """
        body = Body()
        response = self.client.open('/v2/article',
                                    method='POST',
                                    data=json.dumps(body),
                                    content_type='application/json')
        self.assert200(response,
                       'Response body is : ' + response.data.decode('utf-8'))
    def test_get_employees_search_results(self):
        """Test case for get_employees_search_results

        Get employee's search results
        """
        body = Body()
        response = self.client.open('/employees/search',
                                    method='POST',
                                    data=json.dumps(body),
                                    content_type='application/json')
        self.assert200(response,
                       'Response body is : ' + response.data.decode('utf-8'))
    def test_html2pdf(self):
        """Test case for html2pdf

        Convert html with addtional files to pdf
        """
        body = Body()
        response = self.client.open('/v1/html2pdf',
                                    method='POST',
                                    data=json.dumps(body),
                                    content_type='application/json')
        self.assert200(response,
                       'Response body is : ' + response.data.decode('utf-8'))
    def test_filters(self):
        """Test case for filters

        urlから判断する
        """
        body = Body()
        response = self.client.open('/api/filters',
                                    method='POST',
                                    data=json.dumps(body),
                                    content_type='application/json')
        self.assert200(response,
                       'Response body is : ' + response.data.decode('utf-8'))
示例#10
0
    def test_update_pet(self):
        """
        Test case for update_pet

        Update an existing pet
        """
        body = Body()
        response = self.client.open('/v2/pet',
                                    method='PUT',
                                    data=json.dumps(body),
                                    content_type='application/json')
        self.assert200(response,
                       "Response body is : " + response.data.decode('utf-8'))
    def test_update_station(self):
        """Test case for update_station

        update existing station
        """
        body = Body()
        response = self.client.open(
            '/ayhanyunt12/MeteorolojiAPI/1.0.0/station',
            method='PUT',
            data=json.dumps(body),
            content_type='application/json')
        self.assert200(response,
                       'Response body is : ' + response.data.decode('utf-8'))
示例#12
0
    def test_add_problem(self):
        """
        Test case for add_problem

        Creates a new problem and returns a problemID with default version 0
        """
        problem = Body()
        response = self.client.open('/v2/',
                                    method='POST',
                                    data=json.dumps(problem),
                                    content_type='application/json')
        self.assert200(response,
                       "Response body is : " + response.data.decode('utf-8'))
    def test_add_product(self):
        """
        Test case for add_product

        Add a new product to the store
        """
        body = Body()
        response = self.client.open('/v2/v1/products',
                                    method='POST',
                                    data=json.dumps(body),
                                    content_type='application/json')
        self.assert200(response,
                       "Response body is : " + response.data.decode('utf-8'))
示例#14
0
    def test_post_analytic(self):
        """
        Test case for post_analytic

        Update the existing analytic
        """
        problem = Body()
        response = self.client.open(
            '/v1/analytic/ver={version}/'.format(version=789),
            method='POST',
            data=json.dumps(problem),
            content_type='application/json')
        self.assert200(response,
                       "Response body is : " + response.data.decode('utf-8'))
    def test_question_capsule_cid_post(self):
        """Test case for question_capsule_cid_post

        Post new answer for question capsules
        """
        body = Body()
        response = self.client.open(
            '/VegetableP/Time-Capsule-Post-2019/1.0.0/question_capsule/{cid}'.
            format(cid=56),
            method='POST',
            data=json.dumps(body),
            content_type='application/json')
        self.assert200(response,
                       'Response body is : ' + response.data.decode('utf-8'))
示例#16
0
    def test_update_problem(self):
        """
        Test case for update_problem

        Update the existing problem
        """
        problem = Body()
        response = self.client.open(
            '/v2/id={problem_id}/ver={version}/'.format(
                problem_id=56, version=56),
            method='PUT',
            data=json.dumps(problem),
            content_type='application/json')
        self.assert200(response,
                       "Response body is : " + response.data.decode('utf-8'))
    def test_put_pipeline_favorite(self):
        """
        Test case for put_pipeline_favorite

        
        """
        body = Body()
        response = self.client.open(
            '//blue/rest/organizations/{organization}/pipelines/{pipeline}/favorite'
            .format(organization='organization_example',
                    pipeline='pipeline_example'),
            method='PUT',
            data=json.dumps(body),
            content_type='application/json')
        self.assert200(response,
                       "Response body is : " + response.data.decode('utf-8'))
    def test_obtener_progresion_lineal(self):
        """
        Test case for obtener_progresion_lineal

        Obtener la prediccion para un año dado el año a predecir y los datos de varios años anteriores
        """
        body = [Body()]
        query_string = [('AnioPrediccion', '2009')]
        response = self.client.open(
            '/server/Calculos/ObtenerProgresionLineal/',
            method='POST',
            data=json.dumps(body),
            content_type='application/json',
            query_string=query_string)
        self.assert200(response,
                       "Response body is : " + response.data.decode('utf-8'))
def get_employees_search_results(body=None):  # noqa: E501
    """Search employee' results

    Get employee's search results # noqa: E501

    :param body: 
    :type body: dict | bytes

    :rtype: Employees
    """

    #bodyを取得
    if connexion.request.is_json:
        #body = Body.from_dict(connexion.request.get_json())  # noqa: E501
        body = Body().from_dict(connexion.request.get_json())

    #接続情報の作成
    engine = sqlalchemy.create_engine(
        'postgresql://*****:*****@wakupy-db.csw5cdbrfmzu.ap-northeast-1.rds.amazonaws.com/omurice'
    )

    # クエリの作成
    query = "SELECT * FROM public.m_employee WHERE 1=1"

    #検索条件にemployee_idが指定された場合
    if not body.employee_id:
        pass
    else:
        query += " AND employee_id like '%%{}%%'".format(body.employee_id)

    #検索条件にemployee_nameが指定された場合
    if not body.employee_name:
        pass
    else:
        query += " AND employee_name like '%%{}%%'".format(body.employee_name)

    #検索条件にdeptが指定された場合(チェックボックス)
    if not body.dept:
        pass
    else:
        for index, dept in enumerate(body.dept):
            if index == 0:
                query += " AND dept in ('{}'".format(dept)
            else:
                query += " ,'{}'".format(dept)

        query += ")"

    #検索条件にjoining_year_fromが指定された場合
    if not body.joining_year_from:
        pass
    else:
        query += " AND joining_year >= '{}'".format(body.joining_year_from)

    #検索条件にjoining_year_toが指定された場合
    if not body.joining_year_to:
        pass
    else:
        query += " AND joining_year <= '{}'".format(body.joining_year_to)

    #検索条件にtitleが指定された場合(チェックボックス)
    if not body.title:
        pass
    else:
        for index, title in enumerate(body.title):
            if index == 0:
                query += " AND title in ('{}'".format(title)
            else:
                query += " ,'{}'".format(title)

        query += ")"

    #検索条件にgradeが指定された場合(チェックボックス)
    if not body.grade:
        pass
    else:
        for index, grade in enumerate(body.grade):
            if index == 0:
                query += " AND grade in ('{}'".format(grade)
            else:
                query += " ,'{}'".format(grade)

        query += ")"

    #検索条件にrecruitment_classが指定された場合(チェックボックス)
    if not body.recruitment_class:
        pass
    else:
        for index, recruitment in enumerate(body.recruitment_class):
            if index == 0:
                query += " AND recruitment_class in ('{}'".format(recruitment)
            else:
                query += " ,'{}'".format(recruitment)

        query += ")"

    #検索条件にleave_flgが指定された場合(チェックボックス)
    if not body.leave_flg:
        pass
    else:
        for index, leave_flg in enumerate(body.leave_flg):
            if index == 0:
                query += " AND leave_flg in ('{}'".format(leave_flg)
            else:
                query += " ,'{}'".format(leave_flg)

        query += ")"

    #検索条件にgenderが指定された場合(チェックボックス)
    if not body.gender:
        pass
    else:
        for index, gender in enumerate(body.gender):
            if index == 0:
                query += " AND gender in ('{}'".format(gender)
            else:
                query += " ,'{}'".format(gender)

        query += ")"

    #検索条件にbirthdate_fromが指定された場合
    if not body.birthdate_from:
        pass
    else:
        query += " AND birthdate >= '{}'".format(body.birthdate_from)

    #検索条件にbirthdate_fromが指定された場合
    if not body.birthdate_to:
        pass
    else:
        query += " AND birthdate <= '{}'".format(body.birthdate_to)

    #クエリの実行
    result = engine.execute(query)

    #結果を格納するリストの作成
    employees = []
    employees_inner = EmployeesInner()

    for row in result:
        employees_inner.employee_id = row['employee_id']
        employees_inner.employee_name = row['employee_name']
        employees_inner.dept = row['dept']
        employees_inner.joining_year = row['joining_year']
        employees_inner.title = row['title']
        employees_inner.grade = row['grade']
        employees_inner.recruitment_class = row['recruitment_class']
        #employees_inner.leave_flg = row['leave_flg']
        employees_inner.gender = row['gender']
        employees_inner.birthdate = row['birthdate']

        employees.append(copy.copy(employees_inner))

    #接続クローズ
    result.close()

    return employees