Skip to content

Commit cf00d25

Browse files
rootefajardo
authored andcommitted
Removing the dependency of python requests
1 parent 97b018e commit cf00d25

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

osgtest/tests/test_465_xrootd_tpc.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import os
22
import json
33
import pwd
4-
import requests
54

65
import osgtest.library.core as core
76
import osgtest.library.files as files
@@ -18,34 +17,34 @@ def test_01_create_macaroons(self):
1817
usercert = '/tmp/x509up_u%d' % uid
1918
userkey = '/tmp/x509up_u%d' % uid
2019

21-
core.config['xrootd.tpc.url-1'] = "https://" + core.get_hostname() + ":9001" + "/usr/share/osg-test/test_gridftp_data.txt"
20+
core.config['xrootd.tpc.url-1'] = "https://" + core.get_hostname() + ":9001" + "/usr/share/osg-test/test_gridftp_data.txt".strip()
2221
command = ('macaroon-init', core.config['xrootd.tpc.url-1'], '20', 'DOWNLOAD')
2322

2423
status, stdout, stderr = core.system(command, user=True)
2524
fail = core.diagnose('Obtain Macaroon one',
2625
command, status, stdout, stderr)
27-
core.config['xrootd.tpc.macaroon-1'] = stdout.strip('\n')
26+
core.config['xrootd.tpc.macaroon-1'] = stdout.strip()
2827

29-
core.config['xrootd.tpc.url-2'] = "https://" + core.get_hostname() + ":9002" + "/tmp/test_gridftp_data_tpc.txt"
28+
core.config['xrootd.tpc.url-2'] = "https://" + core.get_hostname() + ":9002" + "/tmp/test_gridftp_data_tpc.txt".strip()
3029
command = ('macaroon-init', core.config['xrootd.tpc.url-2'], '20', 'UPLOAD')
3130
status, stdout, stderr = core.system(command, user=True)
3231
fail = core.diagnose('Obtain Macaroon number two',
3332
command, status, stdout, stderr)
34-
core.config['xrootd.tpc.macaroon-2'] = stdout.strip('\n')
33+
core.config['xrootd.tpc.macaroon-2'] = stdout.strip()
3534

3635

3736
def test_02_initate_tpc(self):
38-
core.skip_ok_unless_installed('xrootd', 'xrootd-scitokens', by_dependency=True)
39-
session = requests.Session()
40-
session.verify = False
37+
core.skip_ok_unless_installed('xrootd', 'xrootd-scitokens', 'x509-scitokens-issuer-client', by_dependency=True)
4138
headers = {}
42-
headers['Overwrite'] = 'T'
43-
headers['Authorization'] = 'Bearer %s' % core.config['xrootd.tpc.macaroon-1']
44-
headers['Source'] = core.config['xrootd.tpc.url-1']
45-
headers['Copy-Header'] = 'Authorization: Bearer %s' % core.config['xrootd.tpc.macaroon-2']
46-
resp = session.request('COPY',
47-
core.config['xrootd.tpc.url-2'], headers=headers,
48-
allow_redirects=True)
39+
command = ('curl', '-A', 'Test', "-vk", "-X", "COPY",
40+
'-H', "Authorization: Bearer %s" % core.config['xrootd.tpc.macaroon-1'],
41+
'-H', "Source: %s" % core.config['xrootd.tpc.url-1'],
42+
'-H', 'Overwrite: T',
43+
'-H', 'Copy-Header: Authorization: Bearer %s'% core.config['xrootd.tpc.macaroon-2'],
44+
core.config['xrootd.tpc.url-2'])
45+
status, stdout, stderr = core.system(command, user=True)
46+
fail = core.diagnose('Initiate third party copy',
47+
command, status, stdout, stderr)
4948
file_copied = os.path.exists("/tmp/test_gridftp_data_tpc.txt")
5049
self.assert_(file_copied, 'Copied file missing')
5150
chechskum_match = files.checksum_files_match("/tmp/test_gridftp_data_tpc.txt", "/usr/share/osg-test/test_gridftp_data.txt")

osgtest/tests/test_838_xrootd_tpc.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ def test_01_stop_xrootd(self):
1717
service.check_stop(core.config['xrootd_tpc_service_1'])
1818
service.check_stop(core.config['xrootd_tpc_service_2'])
1919

20+
def test_02_clean_test_files(self):
21+
files.remove("/tmp/test_gridftp_data_tpc.txt", force=True)

0 commit comments

Comments
 (0)