def test_requests(self):
        self.driver.implicitly_wait(3.5)

        with apiritif.transaction('/'):
            self.driver.get('http://blazedemo.com/')

            WebDriverWait(self.driver, 3.5).until(econd.presence_of_element_located((By.XPATH, "//input[@type='submit']")), 'Element "//input[@type=\'submit\']" failed to appear within 3.5s')
            self.assertEqual(self.driver.title,'BlazeDemo')
            ActionChains(self.driver).move_to_element(self.driver.find_element(By.XPATH, '/html/body/div[2]/div/p[2]/a')).perform()
            ActionChains(self.driver).double_click(self.driver.find_element(By.XPATH, '/html/body/div[3]/h2')).perform()
            ActionChains(self.driver).click_and_hold(self.driver.find_element(By.XPATH, '/html/body/div[3]/form/select[1]')).perform()
            ActionChains(self.driver).release(self.driver.find_element(By.XPATH, '/html/body/div[3]/form/select[1]/option[6]')).perform()
            Select(self.driver.find_element(By.NAME, 'toPort')).select_by_visible_text('London')
            self.driver.find_element(By.CSS_SELECTOR, 'body input.btn.btn-primary').send_keys(Keys.ENTER)
            self.assertEqual(self.driver.find_element(By.ID, 'address').get_attribute('value'),'123 Beautiful st.')
            self.assertEqual(self.driver.find_element(By.XPATH, '/html/body/div[2]/form/div[1]/label').get_attribute('innerText'),'Name')
            WebDriverWait(self.driver, 3.5).until(econd.visibility_of_element_located((By.NAME, 'toPort')), "Element 'toPort' failed to appear within 3.5s")
            self.driver.find_element(By.NAME, 'toPort').send_keys('B')
            self.driver.find_element(By.XPATH, '//div[3]/form/select[1]//option[3]').click()
            self.driver.find_element(By.XPATH, '//div[3]/form/select[2]//option[6]').click()
            self.driver.find_element(By.XPATH, "//input[@type='submit']").click()
            sleep(3)
            self.driver.delete_all_cookies()
            self.driver.find_element(By.LINK_TEXT, 'destination of the week! The Beach!').click()


        body = self.driver.page_source
        re_pattern = re.compile(r'contained_text')
        self.assertEqual(0, len(re.findall(re_pattern, body)), "Assertion: 'contained_text' found in BODY")

        with apiritif.transaction('empty'):
            pass
Esempio n. 2
0
 def test_3_t2(self):
     with apiritif.transaction('t_2'):
         response = apiritif.http.get('url_2.0')
         sleep(2.0)
         with apiritif.transaction('t_22'):
             response = apiritif.http.get('url_22.0')
             sleep(3.0)
Esempio n. 3
0
 def test_3_t2(self):
     with apiritif.transaction('t_2'):
         response = apiritif.http.get('url_2.0')
         sleep(2.0)
         with apiritif.transaction('t_22'):
             response = apiritif.http.get('url_22.0')
             sleep(3.0)
    def test_requests(self):
        self.driver.implicitly_wait(3.5)

        with apiritif.transaction('/'):
            self.driver.get('http://blazedemo.com/')

            WebDriverWait(self.driver, 3.5).until(econd.presence_of_element_located((By.XPATH, "//input[@type='submit']")), 'Element "//input[@type=\'submit\']" failed to appear within 3.5s')
            self.assertEqual(self.driver.title,'BlazeDemo')
            ActionChains(self.driver).move_to_element(self.driver.find_element(By.XPATH, '/html/body/div[2]/div/p[2]/a')).perform()
            ActionChains(self.driver).double_click(self.driver.find_element(By.XPATH, '/html/body/div[3]/h2')).perform()
            ActionChains(self.driver).click_and_hold(self.driver.find_element(By.XPATH, '/html/body/div[3]/form/select[1]')).perform()
            ActionChains(self.driver).release(self.driver.find_element(By.XPATH, '/html/body/div[3]/form/select[1]/option[6]')).perform()
            Select(self.driver.find_element(By.NAME, 'toPort')).select_by_visible_text('London')
            self.driver.find_element(By.CSS_SELECTOR, 'body input.btn.btn-primary').send_keys(Keys.ENTER)
            self.assertEqual(self.driver.find_element(By.ID, 'address').get_attribute('value'),'123 Beautiful st.')
            WebDriverWait(self.driver, 3.5).until(econd.visibility_of_element_located((By.NAME, 'toPort')), "Element 'toPort' failed to appear within 3.5s")
            self.driver.find_element(By.NAME, 'toPort').send_keys('B')
            self.driver.find_element(By.XPATH, '//div[3]/form/select[1]//option[3]').click()
            self.driver.find_element(By.XPATH, '//div[3]/form/select[2]//option[6]').click()
            self.driver.find_element(By.XPATH, "//input[@type='submit']").click()
            sleep(3)
            self.driver.delete_all_cookies()
            self.driver.find_element(By.LINK_TEXT, 'destination of the week! The Beach!').click()


        body = self.driver.page_source
        re_pattern = re.compile(r'contained_text')
        self.assertEqual(0, len(re.findall(re_pattern, body)), "Assertion: 'contained_text' found in BODY")

        with apiritif.transaction('empty'):
            pass
Esempio n. 5
0
    def test_requests(self):
        self.driver.implicitly_wait(3.5)

        with apiritif.transaction('/'):
            self.driver.get('http://blazedemo.com/')

            WebDriverWait(self.driver, 3.5).until(
                econd.visibility_of_element_located((By.NAME, 'toPort')),
                "Element 'toPort' failed to appear within 3.5s")
            self.driver.find_element(By.NAME, 'toPort').send_keys('B')
            self.driver.find_element(
                By.XPATH, '//div[3]/form/select[1]//option[3]').click()
            self.driver.find_element(
                By.XPATH, '//div[3]/form/select[2]//option[6]').click()
            self.driver.find_element(By.XPATH,
                                     "//input[@type='submit']").click()
            sleep(3)
            self.driver.delete_all_cookies()
            self.driver.find_element(
                By.LINK_TEXT, 'destination of the week! The Beach!').click()

        body = self.driver.page_source
        re_pattern = re.compile(r'contained_text')
        self.assertEqual(0, len(re.findall(re_pattern, body)),
                         "Assertion: 'contained_text' found in BODY")

        with apiritif.transaction('empty'):
            pass
Esempio n. 6
0
    def test_5_multiple_transactions(self):
        with transaction("Transaction 1"):
            target.get('/')
            target.get('/2')

        with transaction("Transaction 2"):
            target.get('/')
            target.get('/2')
    def test_requests(self):
        with apiritif.transaction('blazedemo 123'):
            response = apiritif.http.get('http://demo.blazemeter.com/echo.php?echo=123', allow_redirects=True)
            response.assert_jsonpath('$.GET.echo', expected_value='123')
        time.sleep(0.75)

        with apiritif.transaction('blazedemo 456'):
            response = apiritif.http.get('http://demo.blazemeter.com/echo.php?echo=456', allow_redirects=True)
            response.assert_jsonpath("$['GET']['echo']", expected_value='456789')
        time.sleep(0.75)
Esempio n. 8
0
    def test_requests(self):
        with apiritif.transaction('blazedemo 123'):
            response = apiritif.http.get('https://api.demoblaze.com/entries',
                                         allow_redirects=True)
            response.assert_jsonpath('$.LastEvaluatedKey.id',
                                     expected_value='9')
        time.sleep(0.75)

        with apiritif.transaction('blazedemo 456'):
            response = apiritif.http.get('https://api.demoblaze.com/entries',
                                         allow_redirects=True)
            response.assert_jsonpath("$['LastEvaluatedKey']['id']",
                                     expected_value='9')
        time.sleep(0.75)
Esempio n. 9
0
 def test_2_t1(self):
     with apiritif.transaction('t_1'):
         response = apiritif.http.get('url_1.0')
         response = apiritif.http.get('url_1.1', headers={
             'o': 'ne',
             't': 'wo',
         })
    def test_requests(self):
        self.driver.implicitly_wait(3.5)

        with apiritif.transaction('/'):
            self.driver.get('http://blazedemo.com/')

            WebDriverWait(self.driver, 3.5).until(econd.presence_of_element_located((By.XPATH, "//input[@type='submit']")), 'Element "//input[@type=\'submit\']" failed to appear within 3.5s')
            self.assertEqual(self.driver.title,'BlazeDemo')


        body = self.driver.page_source
        re_pattern = re.compile(r'contained_text')
        self.assertEqual(0, len(re.findall(re_pattern, body)), "Assertion: 'contained_text' found in BODY")

        with apiritif.transaction('empty'):
            pass
Esempio n. 11
0
def log_it(name, data):
    variables = ":".join(
        (data["name"], data["pass"], data["name+"], data["pass+"]))
    log_line = "%s-%s. %s\n" % (get_index(), name, variables)
    with apiritif.transaction(
            log_line):  # write log_line into report file for checking purposes
        pass
Esempio n. 12
0
 def test_2_empty(self):
     try:
         self.driver.execute_script('/* FLOW_MARKER test-case-start */', {
             'testCaseName': 'empty',
             'testSuiteName': 'loc_sc_remote',
         })
         with apiritif.transaction('empty'):
             pass
     except AssertionError as exc:
         self.driver.execute_script('/* FLOW_MARKER test-case-stop */', {
             'status': 'failed',
             'message': str(exc),
         })
         raise
     except BaseException as exc:
         self.driver.execute_script('/* FLOW_MARKER test-case-stop */', {
             'status': 'broken',
             'message': str(exc),
         })
         raise
     else:
         self.driver.execute_script('/* FLOW_MARKER test-case-stop */', {
             'status': 'success',
             'message': '',
         })
Esempio n. 13
0
        def put(self, topic, data=None, json=None, headers=None):
            # TODO: parse key out of URL
            if topic.startswith('/'):
                topic = topic[1:]

            if data is None and json is not None:
                data = json_lib.dumps(json)

            with apiritif.transaction('kafka://[' + self.address + ']/' +
                                      topic):
                logging.info("Sending message to Kafka topic %r: %r", topic,
                             data)
                self.producer.produce(
                    topic, data, headers=[] if headers is None else headers)
                self.producer.poll(0)
                self.producer.flush()

                wrapped_req = self._make_request(
                    'PUT',
                    'kafka://' + self.address.split(',')[0] + '/' + topic,
                    data)
                wrapped_response = self._make_response(wrapped_req)
                recorder.record_http_request('PUT', self.address, wrapped_req,
                                             wrapped_response,
                                             _context.session)

            return wrapped_response
Esempio n. 14
0
 def test_8_transaction_attach(self):
     with transaction("Label") as tran:
         user_input = "YO"
         tran.set_request("Request body")
         tran.set_response("Response body")
         tran.set_response_code(201)
         tran.attach_extra("user", user_input)
Esempio n. 15
0
 def test_1_(self):
     try:
         self.driver.execute_script('/* FLOW_MARKER test-case-start */', {
             'testCaseName': '/',
             'testSuiteName': 'loc_sc_remote',
         })
         with apiritif.transaction('/'):
             self.driver.get('http://blazedemo.com/')
             WebDriverWait(self.driver, 3.5).until(
                 econd.presence_of_element_located(
                     (By.XPATH, "//input[@type='submit']")),
                 'Element "//input[@type=\'submit\']" failed to appear within 3.5s'
             )
             self.assertEqual(self.driver.title, 'BlazeDemo')
             body = self.driver.page_source
             re_pattern = re.compile('contained_text')
             self.assertEqual(0, len(re.findall(re_pattern, body)),
                              "Assertion: 'contained_text' found in BODY")
     except AssertionError as exc:
         self.driver.execute_script('/* FLOW_MARKER test-case-stop */', {
             'status': 'failed',
             'message': str(exc),
         })
         raise
     except BaseException as exc:
         self.driver.execute_script('/* FLOW_MARKER test-case-stop */', {
             'status': 'broken',
             'message': str(exc),
         })
         raise
     else:
         self.driver.execute_script('/* FLOW_MARKER test-case-stop */', {
             'status': 'success',
             'message': '',
         })
Esempio n. 16
0
 def test_2_t1(self):
     with apiritif.transaction('t_1'):
         response = apiritif.http.get('url_1.0')
         response = apiritif.http.get('url_1.1',
                                      headers={
                                          'o': 'ne',
                                          't': 'wo',
                                      })
Esempio n. 17
0
def get_http_target(key, auth_callback=dummy_auth):
    if key in _context.targets:
        return _context.targets[key]

    target = TargetService(key)
    _context.targets[key] = target
    with apiritif.transaction("authentication"):
        auth_callback(key, target)
    _context.global_headers.update(target.get_additional_headers())
    return target
Esempio n. 18
0
 def test_5_add_into_posts(self):
     with apiritif.transaction('add into posts'):
         response = self.target.post('/posts', headers={
             'content-type': 'application/json',
         }, json={
             'body': 'bar',
             'title': 'foo',
             'userId': self.vars['userID'],
         })
         self.vars['addedID'] = response.extract_jsonpath('$.id', 'NOT_FOUND')
Esempio n. 19
0
 def test_5_add_into_posts(self):
     with apiritif.transaction('add into posts'):
         response = target.post('/posts', headers={
             'content-type': 'application/json',
         }, json={
             'body': 'bar',
             'title': 'foo',
             'userId': vars['userID'],
         })
     vars['addedID'] = response.extract_jsonpath('$.id', 'NOT_FOUND')
Esempio n. 20
0
    def test_flow_mindetail(self):
        tmp = tempfile.NamedTemporaryFile()
        tmp.close()

        with fake_process(tmp.name):
            with apiritif.transaction("tran"):
                pass

        with open(tmp.name) as fp:
            data = json.load(fp)

        self.assertNotEqual({}, data)
Esempio n. 21
0
 def test_requests(self):
     target = apiritif.http.target('https://jsonplaceholder.typicode.com')
     target.keep_alive(True)
     target.auto_assert_ok(True)
     target.use_cookies(True)
     target.allow_redirects(True)
     target.timeout(5.0)
      
     with apiritif.transaction('just get'):
         response = target.get('/')
      
     with apiritif.transaction('get posts'):
         response = target.get('/posts')
         response.assert_jsonpath('$.[0].userId', expected_value=1)
     userID = response.extract_jsonpath('$.[5].userId', 'NOT_FOUND')
      
     with apiritif.transaction('get posts of certain user'):
         response = target.get('/posts?userId={}'.format(userID))
     postID = response.extract_jsonpath('$.[0].id', 'NOT_FOUND')
      
     with apiritif.transaction('get comments on post'):
         response = target.get('/posts/{}/comments'.format(postID))
         response.assert_jsonpath('$[0].email', expected_value=None)
      
     with apiritif.transaction('add into posts'):
         response = target.post('/posts', headers={'content-type': 'application/json'}, json={'body': 'bar', 'title': 'foo', 'userId': userID})
     addedID = response.extract_jsonpath('$.id', 'NOT_FOUND')
      
     with apiritif.transaction('delete from posts'):
         response = target.delete('/posts/{}'.format(postID))
Esempio n. 22
0
    def test_requests(self):
        with apiritif.transaction('just get'):
            response = self.target.get('/')

        with apiritif.transaction('get posts'):
            response = self.target.get('/posts')
        response.assert_jsonpath('$.[0].userId', expected_value=1)
        userID = response.extract_jsonpath('$.[5].userId', 'NOT_FOUND')

        with apiritif.transaction('get posts of certain user'):
            response = self.target.get('/posts?userId=' + str(userID))
        postID = response.extract_jsonpath('$.[0].id', 'NOT_FOUND')

        with apiritif.transaction('get comments on post'):
            response = self.target.get('/posts/' + str(postID) + '/comments')
        response.assert_jsonpath('$[0].email', expected_value=None)

        with apiritif.transaction('add into posts'):
            response = self.target.post(
                '/posts',
                headers={'content-type': 'application/json'},
                json={
                    'body': 'bar',
                    'title': 'foo',
                    'userId': str(userID)
                })
        addedID = response.extract_jsonpath('$.id', 'NOT_FOUND')

        with apiritif.transaction('delete from posts'):
            response = self.target.delete('/posts/' + str(postID))
Esempio n. 23
0
 def test_with_extractors(self):
     target = apiritif.http.target('https://jsonplaceholder.typicode.com')
     target.keep_alive(True)
     target.auto_assert_ok(True)
     target.use_cookies(True)
     target.allow_redirects(True)
     target.timeout(5.0)
      
     with apiritif.transaction('just get'):
         response = target.get('/')
      
     with apiritif.transaction('get posts'):
         response = target.get('/posts')
         response.assert_jsonpath('$.[0].userId', expected_value=1)
     userID = response.extract_jsonpath('$.[5].userId', 'NOT_FOUND')
      
     with apiritif.transaction('get posts of certain user'):
         response = target.get('/posts?userId={}'.format(userID))
     postID = response.extract_jsonpath('$.[0].id', 'NOT_FOUND')
      
     with apiritif.transaction('get comments on post'):
         response = target.get('/posts/{}/comments'.format(postID))
         response.assert_jsonpath('$[0].email', expected_value=None)
      
     with apiritif.transaction('add into posts'):
         response = target.post('/posts', headers={'content-type': 'application/json'}, json={'body': 'bar', 'title': 'foo', 'userId': userID})
     addedID = response.extract_jsonpath('$.id', 'NOT_FOUND')
      
     with apiritif.transaction('delete from posts'):
         response = target.delete('/posts/{}'.format(postID))
Esempio n. 24
0
    def test_flow_maxdetail(self):
        tmp = tempfile.NamedTemporaryFile()
        tmp.close()

        with fake_process(tmp.name):
            with apiritif.transaction("tran") as tran:
                tran.set_request(bytes("test", 'utf8'))

            http.post('http://httpbin.org/post',
                      data=bytes([0xa0, 1, 2, 3]),
                      headers={'Content-Type': 'application/octet-stream'})

        with open(tmp.name) as fp:
            data = json.load(fp)

        self.assertNotEqual({}, data)
Esempio n. 25
0
def get_http_target(key, auth_callback=dummy_auth):
    if key in _context.targets:
        return _context.targets[key]

    target = TargetService(key)
    target.additional_headers({
        "User-Agent":
        "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 "
        "(KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36"
    })
    target.additional_headers({"Referer": target.address + "/"})
    target.additional_headers({"Accept": "*/*"})
    _context.targets[key] = target

    with apiritif.transaction("authentication"):
        auth_callback(key, target)

    _context.global_headers.update(target.get_additional_headers())
    return target
Esempio n. 26
0
    def test_flow_maxdetail(self):
        tmp = tempfile.NamedTemporaryFile()
        tmp.close()
        config = ctype(otype(tmp.name, 3), PytestPluginManager())
        plugin = ApiritifPytestPlugin(config)
        for _ in plugin.pytest_runtest_setup(None):
            pass

        with apiritif.transaction("tran") as tran:
            tran.set_request(bytes("test", 'utf8'))

        node = Node("test", nodeid="tst", config=config, session="some")
        for _ in plugin.pytest_runtest_teardown(node):
            pass

        plugin.pytest_sessionfinish(None)

        with open(tmp.name) as fp:
            data = json.load(fp)

        self.assertNotEqual({}, data)
Esempio n. 27
0
        def intercept_unary_unary(self, continuation,
                                  client_call_details: _ClientCallDetails,
                                  request):
            # inject timeout
            client_call_details = _ClientCallDetails(
                client_call_details.method, self.timeout,
                client_call_details.metadata, client_call_details.credentials,
                client_call_details.wait_for_ready,
                client_call_details.compression)
            logging.info("Sending gRPC call to %r: %r",
                         client_call_details.method, request)
            # FIXME: we work with continuation wrong here, should not been calling result() on it maybe?
            url = "grpc://" + self.address + client_call_details.method
            with apiritif.transaction(url) as tran:
                wrapped_req = self._make_request(client_call_details.method,
                                                 url, request)
                tran.set_request(repr(request))
                tran.attach_extra("grpc_req_class",
                                  request.DESCRIPTOR.full_name)

                continuation = continuation(client_call_details, request)

                code = continuation.code()
                tran.set_response_code(code.value[0])
                msg = "gRPC status %s: %s" % (code, continuation.details())
                logging.info(msg)
                if code != grpc.StatusCode.OK:
                    tran.fail(msg)

                resp = continuation.result()
                tran.attach_extra("grpc_resp_class", resp.DESCRIPTOR.full_name)
                tran.set_response(repr(resp))
                logging.info("gRPC response: %r", resp)
                wrapped_response = self._make_response(resp, wrapped_req, code)
                recorder.record_http_request(client_call_details.method,
                                             self.address, wrapped_req,
                                             wrapped_response,
                                             _context.session)

                return continuation
Esempio n. 28
0
def get_http_target(key, auth_callback=dummy_auth):
    if key in _context.targets:
        return _context.targets[key]

    target = TargetService(key)
    target.additional_headers({
        "User-Agent":
        "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 "
        "(KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36"
    })
    target.additional_headers({"Referer": target.address + "/"})
    target.additional_headers({"Accept": "*/*"})
    _context.targets[key] = target

    with apiritif.transaction("authentication"):
        auth_callback(key, target)

    target.uses_auth = auth_callback is not dummy_auth

    _context.global_headers.update(target.get_additional_headers())
    if target.uses_auth:  # to support from_cookie() before any request happened
        target._headers_from_token_map({}, "", "")
    return target
Esempio n. 29
0
    def test_flow_maxdetail(self):
        tmp = tempfile.NamedTemporaryFile()
        tmp.close()
        config = ctype(otype(tmp.name, 4), PytestPluginManager())
        plugin = ApiritifPytestPlugin(config)
        for _ in plugin.pytest_runtest_setup(None):
            pass

        with apiritif.transaction("tran") as tran:
            tran.set_request(bytes("test", 'utf8'))

        http.post('http://httpbin.org/post', data=bytes([0xa0, 1, 2, 3]),
                  headers={'Content-Type': 'application/octet-stream'})

        node = Node("test", nodeid="tst", config=config, session="some")
        for _ in plugin.pytest_runtest_teardown(node):
            pass

        plugin.pytest_sessionfinish(None)

        with open(tmp.name) as fp:
            data = json.load(fp)

        self.assertNotEqual({}, data)
Esempio n. 30
0
 def test_3_an(self):
     with apiritif.transaction(self.vars['an']):
         response = self.target.get(self.vars['an'])
Esempio n. 31
0
def _do_clear_session(metadata):
    with apiritif.transaction("clear_session: " + json.dumps(metadata)):
        _context.clear()
Esempio n. 32
0
 def test_6_delete_from_posts(self):
     with apiritif.transaction('delete from posts'):
         response = target.delete('/posts/{}'.format(vars['postID']))
Esempio n. 33
0
 def test_4_get_comments_on_post(self):
     with apiritif.transaction('get comments on post'):
         response = target.get('/posts/{}/comments'.format(vars['postID']))
         response.assert_jsonpath('$[0].email', expected_value=None)
Esempio n. 34
0
 def test_3_get_posts_of_certain_user(self):
     with apiritif.transaction('get posts of certain user'):
         response = target.get('/posts?userId={}'.format(vars['userID']))
     vars['postID'] = response.extract_jsonpath('$.[0].id', 'NOT_FOUND')
Esempio n. 35
0
 def test_2_get_posts(self):
     with apiritif.transaction('get posts'):
         response = target.get('/posts')
         response.assert_jsonpath('$.[0].userId', expected_value=1)
     vars['userID'] = response.extract_jsonpath('$.[5].userId', 'NOT_FOUND')
Esempio n. 36
0
 def test_1_just_get(self):
     with apiritif.transaction('just get'):
         response = target.get('/')
Esempio n. 37
0
 def test_1_apiritif(self):
     with apiritif.transaction('apiritif'):
         response = apiritif.http.get('http://localhost:8000/')
Esempio n. 38
0
 def test_1_just_get(self):
     with apiritif.transaction('just get'):
         response = target.get('/')
Esempio n. 39
0
 def test_2_get_posts(self):
     with apiritif.transaction('get posts'):
         response = target.get('/posts')
         response.assert_jsonpath('$.[0].userId', expected_value=1)
     vars['userID'] = response.extract_jsonpath('$.[5].userId', 'NOT_FOUND')
Esempio n. 40
0
 def test_1_url0(self):
     with apiritif.transaction('url_0'):
         response = apiritif.http.get('url_0')
Esempio n. 41
0
 def test_3_get_posts_of_certain_user(self):
     with apiritif.transaction('get posts of certain user'):
         response = target.get('/posts?userId={}'.format(vars['userID']))
     vars['postID'] = response.extract_jsonpath('$.[0].id', 'NOT_FOUND')
Esempio n. 42
0
 def test_6_delete_from_posts(self):
     with apiritif.transaction('delete from posts'):
         response = target.delete('/posts/{}'.format(vars['postID']))
Esempio n. 43
0
 def test_4_get_comments_on_post(self):
     with apiritif.transaction('get comments on post'):
         response = target.get('/posts/{}/comments'.format(vars['postID']))
         response.assert_jsonpath('$[0].email', expected_value=None)