1
1
import os
2
2
import json
3
3
import pwd
4
- import requests
5
4
6
5
import osgtest .library .core as core
7
6
import osgtest .library .files as files
@@ -18,34 +17,34 @@ def test_01_create_macaroons(self):
18
17
usercert = '/tmp/x509up_u%d' % uid
19
18
userkey = '/tmp/x509up_u%d' % uid
20
19
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 ()
22
21
command = ('macaroon-init' , core .config ['xrootd.tpc.url-1' ], '20' , 'DOWNLOAD' )
23
22
24
23
status , stdout , stderr = core .system (command , user = True )
25
24
fail = core .diagnose ('Obtain Macaroon one' ,
26
25
command , status , stdout , stderr )
27
- core .config ['xrootd.tpc.macaroon-1' ] = stdout .strip (' \n ' )
26
+ core .config ['xrootd.tpc.macaroon-1' ] = stdout .strip ()
28
27
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 ()
30
29
command = ('macaroon-init' , core .config ['xrootd.tpc.url-2' ], '20' , 'UPLOAD' )
31
30
status , stdout , stderr = core .system (command , user = True )
32
31
fail = core .diagnose ('Obtain Macaroon number two' ,
33
32
command , status , stdout , stderr )
34
- core .config ['xrootd.tpc.macaroon-2' ] = stdout .strip (' \n ' )
33
+ core .config ['xrootd.tpc.macaroon-2' ] = stdout .strip ()
35
34
36
35
37
36
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 )
41
38
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 )
49
48
file_copied = os .path .exists ("/tmp/test_gridftp_data_tpc.txt" )
50
49
self .assert_ (file_copied , 'Copied file missing' )
51
50
chechskum_match = files .checksum_files_match ("/tmp/test_gridftp_data_tpc.txt" , "/usr/share/osg-test/test_gridftp_data.txt" )
0 commit comments