Ejemplo n.º 1
0
    def test_ticket_update_request_by_authorized_users(self, config, login,
                                                       password):
        db_user = GkrDbSteps(config)
        session = HttpSteps.HttpSession()
        login_url = config.base_url + Urls.LOGIN.url + '/ajax'
        ticket_edit_url = config.base_url + Urls.ADMIN_TICKED_EDIT.url
        advance_updated = db_user.fill_advance_queue(Departments.SIMF_DEP,
                                                     Services.SINGLE_WINDOW,
                                                     datetime.now(),
                                                     ObjectTypes.STROI_OBJECT,
                                                     OPERATOR)
        params = {
            'id': advance_updated.id,
            'serviceid': advance_updated.service_id,
            'inputData': rand_str(10),
            'objectsCount': 2
        }

        session.with_method('post').with_params({
            'username': login,
            'password': password
        }).with_url(login_url).submit()
        session.with_method('post').with_url(
            ticket_edit_url % advance_updated.id).with_params(params).submit()
        sleep(2)

        advance_changed = db_user.query_first(
            Advance, advance_updated.id == advance_updated.id)
        db_user.delete_advance_by_id(advance_updated.id)
        assert_that(
            advance_changed.objects_count, equal_to(1),
            'Запрос изменения тикета ' + ticket_edit_url % advance_updated.id +
            ' открыт для авторизованного пользователя ' + login)
Ejemplo n.º 2
0
    def test_history_search_by_fio(self, config, teardown):

        global advance_one, advance_two, history_operator

        user = GkrUserSteps(config)
        db_user = GkrDbSteps(config)
        history_page = HistoryPage(config)

        history_operator = random_user(UserRoles.OPERATOR)
        db_user.create_user(history_operator)
        advance_one = db_user.fill_advance_queue(
            Departments.BEL_DEP, Services.SINGLE_WINDOW,
            datetime.now() - timedelta(days=1), ObjectTypes.STROI_OBJECT,
            history_operator)
        advance_two = db_user.fill_advance_queue(
            Departments.BEL_DEP, Services.GKN,
            datetime.now() - timedelta(days=2), ObjectTypes.DOMOVLADENIE,
            history_operator)

        user.login(history_operator.customers_data.mobile_phone,
                   history_operator.password)
        user.waits_for_element_displayed(history_page.top_menu.LOGOUT)
        user.selects_from_main_menu(MainMenu.HISTORY)
        # поиск по имени
        user.search_history(advance_two.input_data.split()[2])
        user.should_see_list_size(history_page.SEARCH_ROWS, 1)
        user.should_matches_to_list_item(history_page.SEARCH_ROWS,
                                         contains_string(str(advance_two.id)))
        # поиск по фамилии
        user.search_history(advance_one.input_data.split()[1])
        user.should_see_list_size(history_page.SEARCH_ROWS, 1)
        user.should_matches_to_list_item(history_page.SEARCH_ROWS,
                                         contains_string(str(advance_one.id)))
        # поиск по отчеству
        user.search_history(advance_two.input_data.split()[3])
        user.should_see_list_size(history_page.SEARCH_ROWS, 1)
        user.should_matches_to_list_item(history_page.SEARCH_ROWS,
                                         contains_string(str(advance_two.id)))