Example #1
0
def given_i_am_logged_in(context):
    session_key = create_pre_authenticated_session(email='*****@*****.**')
    context.browser.get(context.server_url + "/404_no_such_url/")
    context.browser.add_cookie(dict(
        name=settings.SESSION_COOKIE_NAME,
        value=session_key,
        path='/',
    ))
Example #2
0
def given_i_am_logged_in(context):
    session_key = create_pre_authenticated_session(email='*****@*****.**')
    context.browser.get(context.get_url("/404_no_such_url/"))
    context.browser.add_cookie(dict(
        name=settings.SESSION_COOKIE_NAME,
        value=session_key,
        path="/"
    ))
Example #3
0
 def create_pre_authenticated_session(self, email):
     if self.against_staging:
         session_key = create_session_on_server(self.server_host, email)
     else:
         session_key = create_pre_authenticated_session(email)
     ## to set a cookie we need to first visit the domain.
     ## 404 pages load the quickest!
     self.browser.get(self.server_url + "/404_no_such_url_CREATE_SESSION/")
     self.browser.add_cookie(dict(name=settings.SESSION_COOKIE_NAME, value=session_key, path="/"))
def given_i_am_logged_in(context):
    session_key = create_pre_authenticated_session(email='*****@*****.**')
    ## to set a cookie we need to first visit the domain.
    ## 404 pages load the quickest!
    context.browser.get(context.server_url + "/404_no_such_url/")
    context.browser.add_cookie(dict(
        name=settings.SESSION_COOKIE_NAME,
        value=session_key,
        path='/',
    ))
Example #5
0
def given_i_am_logged_in(context):
    session_key = create_pre_authenticated_session(email='*****@*****.**')
    # In order to set cookies, we visit home page
    context.browser.get(context.get_url("/"))
    context.browser.add_cookie(
        dict(
            name=settings.SESSION_COOKIE_NAME,
            value=session_key,
            path='/',
        ))
Example #6
0
def given_i_am_logged_in(context):
    session_key = create_pre_authenticated_session(email='*****@*****.**')
    ## to set a cookie we need to first visit the domain.
    ## 404 pages load the quickest!
    context.browser.get(context.get_url("/404_no_such_url/"))
    context.browser.add_cookie(
        dict(
            name=settings.SESSION_COOKIE_NAME,
            value=session_key,
            path='/',
        ))
Example #7
0
 def create_pre_authenticated_session(self, email):
     session_key = create_pre_authenticated_session(email)
     ## to set a cookie we need to first visit the domain.
     ## 404 pages load the quickest!
     self.browser.get(self.server_url + "/404_no_such_url/")
     self.browser.add_cookie(
         dict(
             name=settings.SESSION_COOKIE_NAME,
             value=session_key,
             path='/',
         ))
Example #8
0
def given_i_am_logged_in(context):
    session_key = create_pre_authenticated_session(email="*****@*****.**")
    # 为了设定cookie,我们要先访问网站
    # 而404页面是加载最快的
    context.browser.get(context.get_url("/404_no_such_url/"))
    context.browser.add_cookie(
        dict(
            name=settings.SESSION_COOKIE_NAME,
            value=session_key,
            path="/",
        ))
Example #9
0
def given_i_am_logged_in(context):
    '''при условии, что я являюсь зарегистрированным пользователем'''
    session_key = create_pre_authenticated_session(email='*****@*****.**')
    ## установить cookie, которые нужны для первого посещения домена.
    ## страницы 404 загружаются быстрее всего!
    context.browser.get(context.get_url("/404_no_such_url/"))
    context.browser.add_cookie(
        dict(
            name=settings.SESSION_COOKIE_NAME,
            value=session_key,
            path='/',
        ))
Example #10
0
    def create_pre_authenticated_session(self, email):
        if self.staging_server:
            session_key = create_session_on_server(self.staging_server, email)
        else:
            session_key = create_pre_authenticated_session(email)

        self.browser.get(self.live_server_url + '/404_no_such_url')
        self.browser.add_cookie(
            dict(
                name=settings.SESSION_COOKIE_NAME,
                value=session_key,
                path='/',
            ))
Example #11
0
    def create_pre_authenticated_session(self, email):
        if self.staging_server:
            session_key = create_session_on_server(self.staging_server, email)
        else:
            session_key = create_pre_authenticated_session(email)

        # para definir um cookie, precisamos antes acessar o dominio.
        # as paginas 404 são as que carregam mais rapidamente!
        self.browser.get(f'{self.live_server_url}/404_no_such_url/')
        self.browser.add_cookie(
            dict(name=settings.SESSION_COOKIE_NAME,
                 value=session_key,
                 path='/'))
Example #12
0
    def create_pre_authenticated_session(self, email):
        if self.staging_server:
            session_key = create_session_on_server(self.staging_server, email)
        else:
            session_key = create_pre_authenticated_session(email)

        # To set a cookie we need to first visit the domain
        # 404 pages load the quickest!
        self.browser.get(self.live_server_url + '/404_no_such_url/')
        self.browser.add_cookie(
            dict(
                name=settings.SESSION_COOKIE_NAME,
                value=session_key,
                path='/',
            ))
    def create_pre_authenticated_session(self, email):
        if self.against_staging:
            session_key = create_session_on_server(self.server_host, email)
        else:
            session_key = create_pre_authenticated_session(email)

        # # 쿠키를 설정하기 위해 도메인 접속이 필요하다
        # # 404 페이지가 뜬다
        self.browser.get(self.server_url + '/404_no_such_url/')
        self.browser.add_cookie(
            dict(
                name=settings.SESSION_COOKIE_NAME,
                value=session_key,
                path='/',
            )
        )
Example #14
0
    def create_pre_authenticated_session(self, email):
        """создать предварительно аутентифицированный сеанс"""

        if self.staging_server:
            session_key = create_session_on_server(self.staging_server, email)
        else:
            session_key = create_pre_authenticated_session(email)

        # # установить cookie, которые нужны для первого посещения домена.
        # # страницы 404 загружаются быстрее всего!
        self.browser.get(self.live_server_url + "/404_no_such_url/")
        self.browser.add_cookie(
            dict(
                name=settings.SESSION_COOKIE_NAME,
                value=session_key,
                path='/',
            ))
Example #15
0
    def create_pre_authenticated_session(self, username):
        session_key, user = create_pre_authenticated_session(username)
        # to set a cookie we need to first visit the domain.
        # 404 pages load the quickest!
        self.browser.get(self.live_server_url + "/404_no_such_url/")

        cookies = dict(
            name=settings.SESSION_COOKIE_NAME,
            value=session_key,
            secure=False,
            path='/',
            domain='localhost'
        )

        try:
            self.browser.add_cookie(cookies)
        except WebDriverException:
            # despite exception cookie finally is set up
            pass

        return user