Skip to content

Commit 2fd668d

Browse files
committed
test: use certificates for server tests
1 parent 01573e8 commit 2fd668d

File tree

24 files changed

+46
-42
lines changed

24 files changed

+46
-42
lines changed

src/DIRAC/RequestManagementSystem/DB/RequestDB.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -435,10 +435,13 @@ def getRequest(self, reqID=0, assigned=True):
435435
# FIXME: code for backward compatibility
436436
if not request.Owner:
437437
# We go under the assumption that in this case OwnerDN exists
438-
res = getDNForUsername(request.OwnerDN)
439-
if not res["OK"]:
440-
return res
441-
request.Owner = res["Value"][0]
438+
if request.OwnerDN:
439+
res = getDNForUsername(request.OwnerDN)
440+
if not res["OK"]:
441+
return res
442+
request.Owner = res["Value"][0]
443+
else:
444+
request.Owner = "Unknown"
442445
# ##
443446

444447
return S_OK(request)

src/DIRAC/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ def initialize(
227227

228228
if host_credentials:
229229
gConfigurationData.setOptionInCFG("/DIRAC/Security/UseServerCertificate", "yes")
230+
if isinstance(host_credentials, tuple):
230231
gConfigurationData.setOptionInCFG("/DIRAC/Security/CertFile", str(host_credentials[0]))
231232
gConfigurationData.setOptionInCFG("/DIRAC/Security/KeyFile", str(host_credentials[1]))
232233

tests/Integration/AccountingSystem/Test_AccountingDB.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import DIRAC
66

7-
DIRAC.initialize() # Initialize configuration
7+
DIRAC.initialize(require_auth=False, host_credentials=True) # Initialize configuration
88

99
from DIRAC import gLogger
1010
from DIRAC.AccountingSystem.DB.AccountingDB import AccountingDB

tests/Integration/ConfigurationSystem/Test_Helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"""
33
import DIRAC
44

5-
DIRAC.initialize() # Initialize configuration
5+
DIRAC.initialize(require_auth=False, host_credentials=True) # Initialize configuration
66

77
from DIRAC.ConfigurationSystem.Client.Helpers import Resources
88

tests/Integration/DataManagementSystem/Test_Client_FTS3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import DIRAC
99

10-
DIRAC.initialize() # Initialize configuration
10+
DIRAC.initialize(require_auth=False, host_credentials=True) # Initialize configuration
1111

1212
import DIRAC.DataManagementSystem.DB.test.FTS3TestUtils as baseTestModule
1313
from DIRAC.DataManagementSystem.Client.FTS3Client import FTS3Client

tests/Integration/DataManagementSystem/Test_DataIntegrityDB.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@
77
# pylint: disable=invalid-name,wrong-import-position
88
import time
99

10-
from DIRAC import gLogger
11-
1210
import DIRAC
11+
from DIRAC import gLogger
1312

14-
DIRAC.initialize() # Initialize configuration
13+
DIRAC.initialize(require_auth=False, host_credentials=True) # Initialize configuration
1514

1615
from DIRAC.DataManagementSystem.DB.DataIntegrityDB import DataIntegrityDB
1716

tests/Integration/DataManagementSystem/Test_FileCatalogDB.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
"""
55

66
# pylint: disable=invalid-name,wrong-import-position
7-
import unittest
87
import itertools
98
import os
109
import sys
10+
import unittest
1111
from collections import defaultdict
1212

1313
import DIRAC
1414

15-
DIRAC.initialize() # Initialize configuration
15+
DIRAC.initialize(require_auth=False, host_credentials=True) # Initialize configuration
1616

1717
from DIRAC.DataManagementSystem.DB.FileCatalogDB import FileCatalogDB
1818

tests/Integration/Framework/Test_AuthDB.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import DIRAC
77

8-
DIRAC.initialize() # Initialize configuration
8+
DIRAC.initialize(require_auth=False, host_credentials=True) # Initialize configuration
99

1010
from authlib.jose import JsonWebKey, JsonWebSignature, jwt, RSAKey
1111
from authlib.common.encoding import json_b64encode, urlsafe_b64decode, json_loads

tests/Integration/Framework/Test_AuthServer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import DIRAC
88

9-
DIRAC.initialize() # Initialize configuration
9+
DIRAC.initialize(require_auth=False, host_credentials=True) # Initialize configuration
1010

1111
from DIRAC import S_OK
1212
from DIRAC.FrameworkSystem.private.authorization import AuthServer

tests/Integration/Framework/Test_InstalledComponentsDB.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
This program assumes that the service Framework/ComponentMonitoring is running
55
"""
66
# pylint: disable=invalid-name,wrong-import-position
7-
import unittest
8-
import sys
97
import datetime
8+
import sys
9+
import unittest
1010

1111
import DIRAC
1212

13-
DIRAC.initialize() # Initialize configuration
13+
DIRAC.initialize(require_auth=False, host_credentials=True) # Initialize configuration
1414

1515
from DIRAC.FrameworkSystem.Client.ComponentMonitoringClient import ComponentMonitoringClient
1616

0 commit comments

Comments
 (0)