Пример #1
0
    def scenario(self):
        self.sleep()
        card_data = generate_random_card_data(mode='full')
        status, resp, exec_time = wrapped_call_proxy('tokenize_card', card_data)
        self.send_result('tokenize_card', status, resp, exec_time)
        if status != 'success':
            log.debug('Error raised in tokenize_card')
            return
        card_token = get_resp_field(resp, 'card_token')
        cvn_token = get_resp_field(resp, 'cvn_token')
        if not card_token:
            log.debug('Cant find card token in tokenize_card response!')
            return
        if not cvn_token:
            log.debug('Cant find cvn token in tokenize_card response!')
            return
        status, resp, exec_time = wrapped_call_proxy('detokenize_card',
                                                     card_token, cvn_token)
        self.send_result('detokenize_card', status, resp, exec_time)
        if status != 'success':
            log.debug('Error raised in detokenize_card')
            return

        status, resp, exec_time = wrapped_call_proxy('remove_card',
                                                     card_token, cvn_token)
        self.send_result('remove_card', status, resp, exec_time)
        if status != 'success':
            log.debug('Error raised in remove_card')
Пример #2
0
    def scenario(self):
        self.sleep()
        card_data = generate_random_card_data(mode='full')
        status, resp, exec_time = wrapped_call_proxy('tokenize_card',
                                                     card_data)
        self.send_result('tokenize_card', status, resp, exec_time)
        if status != 'success':
            log.debug('Error raised in tokenize_card')
            return
        card_token = get_resp_field(resp, 'card_token')
        cvn_token = get_resp_field(resp, 'cvn_token')
        if not card_token:
            log.debug('Cant find card token in tokenize_card response!')
            return
        if not cvn_token:
            log.debug('Cant find cvn token in tokenize_card response!')
            return
        status, resp, exec_time = wrapped_call_proxy('detokenize_card',
                                                     card_token, cvn_token)
        self.send_result('detokenize_card', status, resp, exec_time)
        if status != 'success':
            log.debug('Error raised in detokenize_card')
            return

        status, resp, exec_time = wrapped_call_proxy('remove_card', card_token,
                                                     cvn_token)
        self.send_result('remove_card', status, resp, exec_time)
        if status != 'success':
            log.debug('Error raised in remove_card')
Пример #3
0
 def test_get_token_without_cvn_post(self):
     card_data = generate_random_card_data(mode='without_cvn')
     status, resp, f_time = call_proxy(self.server_uri,
                                       'tokenize_card', 'POST', card_data)
     self.assertEqual(status, 'success')
     self.assertTrue(get_resp_field(resp, 'card_token'))
     self.assertTrue(get_resp_field(resp, 'pan_masked'))
     self.assertFalse(get_resp_field(resp, 'pan'))
Пример #4
0
 def test_get_token_without_cvn_post(self):
     card_data = generate_random_card_data(mode='without_cvn')
     status, resp, f_time = call_proxy(self.server_uri, 'tokenize_card',
                                       'POST', card_data)
     self.assertEqual(status, 'success')
     self.assertTrue(get_resp_field(resp, 'card_token'))
     self.assertTrue(get_resp_field(resp, 'pan_masked'))
     self.assertFalse(get_resp_field(resp, 'pan'))
Пример #5
0
 def test_remove_card_post(self):
     source_card_data = generate_random_card_data(mode='full')
     status, resp, f_time = call_proxy(self.server_uri, 'tokenize_card',
                                       'POST', source_card_data)
     card_token = get_resp_field(resp, 'card_token')
     cvn_token = get_resp_field(resp, 'cvn_token')
     status, resp, f_time = call_proxy(self.server_uri, 'remove_card',
                                       'POST', card_token, cvn_token)
     self.assertEqual(status, 'success')
Пример #6
0
 def test_remove_card_post(self):
     source_card_data = generate_random_card_data(mode='full')
     status, resp, f_time = call_proxy(self.server_uri,
                                       'tokenize_card', 'POST',
                                       source_card_data)
     card_token = get_resp_field(resp, 'card_token')
     cvn_token = get_resp_field(resp, 'cvn_token')
     status, resp, f_time = call_proxy(
         self.server_uri, 'remove_card', 'POST',
         card_token, cvn_token)
     self.assertEqual(status, 'success')
Пример #7
0
 def test_get_card_get(self):
     source_card_data = generate_random_card_data(mode='full')
     status, resp, f_time = call_proxy(self.server_uri, 'tokenize_card',
                                       'GET', source_card_data)
     card_token = get_resp_field(resp, 'card_token')
     cvn_token = get_resp_field(resp, 'cvn_token')
     status, resp, f_time = call_proxy(self.server_uri, 'detokenize_card',
                                       'GET', card_token, cvn_token)
     self.assertEqual(status, 'success')
     self.assertEqual(source_card_data.pan, get_resp_field(resp, 'pan'))
     self.assertEqual(source_card_data.cvn, get_resp_field(resp, 'cvn'))
Пример #8
0
 def test_get_card_get(self):
     source_card_data = generate_random_card_data(mode='full')
     status, resp, f_time = call_proxy(self.server_uri,
                                       'tokenize_card', 'GET', source_card_data)
     card_token = get_resp_field(resp, 'card_token')
     cvn_token = get_resp_field(resp, 'cvn_token')
     status, resp, f_time = call_proxy(
         self.server_uri, 'detokenize_card', 'GET',
         card_token, cvn_token)
     self.assertEqual(status, 'success')
     self.assertEqual(source_card_data.pan, get_resp_field(resp, 'pan'))
     self.assertEqual(source_card_data.cvn, get_resp_field(resp, 'cvn'))
Пример #9
0
 def test_get_token_multiple_duplicate_post(self):
     card_data = generate_random_card_data(mode='full')
     orig_pan = card_data.pan
     orig_cvn = card_data.cvn
     status, resp, f_time = call_proxy(self.server_uri,
                                       'tokenize_card', 'POST', card_data)
     orig_card_token = get_resp_field(resp, 'card_token')
     orig_cvn_token = get_resp_field(resp, 'cvn_token')
     for _ in range(5):
         card_data.pan = orig_pan
         card_data.cvn = orig_cvn
         status, resp, f_time = call_proxy(self.server_uri,
                                           'tokenize_card', 'POST', card_data)
         dup_card_token = get_resp_field(resp, 'card_token')
         dup_cvn_token = get_resp_field(resp, 'cvn_token')
         self.assertEqual(orig_card_token, dup_card_token)
         self.assertNotEqual(orig_cvn_token, dup_cvn_token)
Пример #10
0
 def test_get_token_multiple_duplicate_post(self):
     card_data = generate_random_card_data(mode='full')
     orig_pan = card_data.pan
     orig_cvn = card_data.cvn
     status, resp, f_time = call_proxy(self.server_uri, 'tokenize_card',
                                       'POST', card_data)
     orig_card_token = get_resp_field(resp, 'card_token')
     orig_cvn_token = get_resp_field(resp, 'cvn_token')
     for _ in range(5):
         card_data.pan = orig_pan
         card_data.cvn = orig_cvn
         status, resp, f_time = call_proxy(self.server_uri, 'tokenize_card',
                                           'POST', card_data)
         dup_card_token = get_resp_field(resp, 'card_token')
         dup_cvn_token = get_resp_field(resp, 'cvn_token')
         self.assertEqual(orig_card_token, dup_card_token)
         self.assertNotEqual(orig_cvn_token, dup_cvn_token)