|
7 | 7 | import unittest |
8 | 8 | from unittest.mock import patch |
9 | 9 |
|
10 | | -try: |
11 | | - from Pilot.proxyTools import getVO, parseASN1 |
12 | | -except ModuleNotFoundError: |
13 | | - from proxyTools import getVO, parseASN1 |
| 10 | +from ..proxyTools import getVO, parseASN1 |
14 | 11 |
|
15 | 12 | class TestProxyTools(unittest.TestCase): |
16 | 13 | def test_getVO(self): |
@@ -84,46 +81,7 @@ def __createFakeProxy(self, proxyFile): |
84 | 81 | """ |
85 | 82 | Create a fake proxy locally. |
86 | 83 | """ |
87 | | - |
88 | 84 | basedir = os.path.dirname(__file__) |
89 | | - shutil.copy(basedir + "/certs/user/userkey.pem", basedir + "/certs/user/userkey400.pem") |
90 | | - os.chmod(basedir + "/certs/user/userkey400.pem", 0o400) |
91 | | - ret = self.createFakeProxy( |
92 | | - basedir + "/certs/user/usercert.pem", |
93 | | - basedir + "/certs/user/userkey400.pem", |
94 | | - "fakeserver.cern.ch:15000", |
95 | | - "fakevo", |
96 | | - basedir + "/certs//host/hostcert.pem", |
97 | | - basedir + "/certs/host/hostkey.pem", |
98 | | - basedir + "/certs/ca", |
99 | | - proxyFile, |
100 | | - ) |
101 | | - os.remove(basedir + "/certs/user/userkey400.pem") |
102 | | - return ret |
103 | | - |
104 | | - def createFakeProxy(self, usercert, userkey, serverURI, vo, hostcert, hostkey, CACertDir, proxyfile): |
105 | | - """ |
106 | | - voms-proxy-fake --cert usercert.pem |
107 | | - --key userkey.pem |
108 | | - -rfc |
109 | | - -fqan "/fakevo/Role=user/Capability=NULL" |
110 | | - -uri fakeserver.cern.ch:15000 |
111 | | - -voms fakevo |
112 | | - -hostcert hostcert.pem |
113 | | - -hostkey hostkey.pem |
114 | | - -certdir ca |
115 | | - """ |
116 | | - opt = ( |
117 | | - '--cert %s --key %s -rfc -fqan "/fakevo/Role=user/Capability=NULL" -uri %s -voms %s -hostcert %s' |
118 | | - " -hostkey %s -certdir %s -out %s" |
119 | | - % (usercert, userkey, serverURI, vo, hostcert, hostkey, CACertDir, proxyfile) |
120 | | - ) |
121 | | - proc = subprocess.Popen( |
122 | | - shlex.split("voms-proxy-fake " + opt), |
123 | | - bufsize=1, |
124 | | - stdout=sys.stdout, |
125 | | - stderr=sys.stderr, |
126 | | - universal_newlines=True, |
127 | | - ) |
128 | | - proc.communicate() |
129 | | - return proc.returncode |
| 85 | + shutil.copy(basedir + "/certs/voms/proxy.pem", proxyFile) |
| 86 | + return 0 |
| 87 | + |
0 commit comments