Skip to content
Snippets Groups Projects
Commit c322a94d authored by William Enright's avatar William Enright
Browse files

added integration test folder to master

parent 71dae469
No related branches found
No related tags found
No related merge requests found
import json
import requests
data = {}
data['username'] = "admin"
data['password'] = "abc123"
header = {}
header['Content-type'] = "application/json"
response = requests.put('http://localhost:8080/api/install/start',data=json.dumps(data),headers=header)
if response.status_code == 200:
print("Succesfully created the administrative user!")
token = json.loads(response.text)['access_token']
else:
print("Could not create admin user, the test has failed!")
header['Bearer'] = token
data = {}
data['fields'] = {}
data['fields']['commonName'] = "TEST CA"
data['fields']['country'] = "FR"
data['fields']['lifetime'] = 10000000
response = requests.post('http://localhost:8080/api/install/ca',data=json.dumps(data),headers=header)
if response.status_code == 200:
print("Added CA parameters!")
else:
print("Could not add CA parameters, the test has failed")
data = {}
data['type'] = "LDAP"
data['ldapSettings'] = {}
data['ldapSettings']['useStartTLS'] = True
data['ldapSettings']['realm'] = "savoirfairelinux"
data['ldapSettings']['baseDN'] = "ou=users,dc=savoirfairelinux,dc=net"
data['ldapSettings']['host'] = "ldap://annuaire.savoirfairelinux.com"
data['ldapSettings']['username'] = "cn=sipallow,ou=dsa,dc=savoirfairelinux,dc=net"
data['ldapSettings']['password'] = "Dewaaghei3Yo"
data['ldapSettings']['usernameField'] = "uid"
data['ldapSettings']['fieldMappings'] = {}
data['ldapSettings']['fieldMappings']['givenName'] = "FirstName"
data['ldapSettings']['fieldMappings']['sn'] = "LastName"
data['ldapSettings']['fieldMappings']['jpegPhoto'] = "ProfilePicture"
data['ldapSettings']['fieldMappings']['mail'] = "Email"
data['ldapSettings']['fieldMappings']['telephoneNumber'] = "PhoneNumber"
data['ldapSettings']['fieldMappings']['mobile'] = "MobileNumber"
data['ldapSettings']['fieldMappings']['facsimileTelephoneNumber'] = "FaxNumber"
data['ldapSettings']['fieldMappings']['extensionName'] = "PhoneNumberExtension"
data['ldapSettings']['fieldMappings']['o'] = "Organization"
response = requests.post('http://localhost:8080/api/install/auth',data=json.dumps(data),headers=header)
if response.status_code == 200:
print("Added LDAP parameters!")
else:
print("Could not add LDAP parameters, the test has failed")
data['serverDomain'] = "http://localhost"
data['signingAlgorithm'] = "SHA512WITHRSA"
data['crlLifetime'] = 100000
data['userLifetime'] = 100000
data['deviceLifetime'] = 100000
response = requests.post('http://localhost:8080/api/install/settings',data=json.dumps(data),headers=header)
#This completes the install, now we'll try to enroll.
data = {}
response = requests.post('http://localhost:8080/api/auth/login',data={"username":"fsidokhine","password":"mes87hesm97daa"})
if response.status_code == 200:
token = json.loads(response.text)['access_token']
header = {}
header['Bearer'] = token
#Now we try this...
data = {}
data['deviceName'] = "Felix Galaxy S8"
data['csr'] = '''-----BEGIN NEW CERTIFICATE REQUEST-----
MIIElTCCAn0CAQAwUDEUMBIGA1UEAxMLSmFtaSBkZXZpY2UxODA2BgoJkiaJk/Is
ZAEBEyg5MzE3MWRiNGI2NTMzOWNjNjM5MGRjYWI5MTQ4MWE0NTYxYzE2YWRmMIIC
IjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA9z561c3zxvj/6VIPC94fg3Hg
S+8Ap6BGGnuaLuJN0AzdzF15ST+SKV/9faIkvH7GUvb+dEitCbQsCmvhG7MDqdUY
jMacLfc4YOM9xOTCi8Zi9+5pAhcxIQQqcT4l/WDo9bwsQmn41REI+KC4sHjqO4/9
2TsWMoCjKM8qv8mhk+ndPGjzTuh2ZoGazXtZYn8KidTKv9X7UK7coDjEx/bjZf1x
nF14atVmhk8sGADRbfKmIsjBo9O89Cn3bljfxRH6ix12tZv1GXtwr8jfMEEEMWct
6kmT0R4tMoAl4ccPTRyFjS5H3VF4flk49LH64XygGA53X/OQPWqxDgIIYAIQV0+7
vlW1XH1TIdblx2Vo8MH99n2CXq611yU8OkI82HHzc1fwtV0ounlzOdi0ESuyDGKs
jPNHbZ1YLHq9oOehDSjspvafoKVO1GSUs6p1uYkdng8M2qskKS1WrSdPNxSBo3Hc
gQqb/DXkQ8N6Z0AasqERmAk4uwqSohx8xoTw7/ZnI0awZh4+UTou+znKGbVCARI6
BYd6tM1Ve43+YMB9rydzOhvrq9tOIKa9mFa807QjmxL4BFOMULVD3LePcrzebQ7h
Pd7P4BbyeQ5KOD735bBu/PZp4prWCBRVY/bG/6JLfQeR1XOgUs0FDqjXQR8uq1J+
MYCuLGr9sdJlwKBYaK0CAwEAAaAAMA0GCSqGSIb3DQEBDAUAA4ICAQCI5HYjgi8j
d/4HoYYuidva1zwxVKbqzjCfghIpc56W2iTdM/XnFZyMrL+HuDQH0uqAKoydTU2S
QYeGK1e5vJbZspt6QlMgNPsp9gxWWx+Wsu4TFDdvJXNvieLuqPZE93X/8DO6D5ck
ptIJxWa4qFNdSKzx6V40lmr6V4YwX4r65rMtpIyzcLemqcbP4I0IOt8R1WHQJJSQ
vU2gkZzuw1lfi+807pQw+X022OLiKykSeEO8bwACXuxQ0zQawV/kz97v+z7NoSvg
iAz2YrQryTt9AhJZJZ4Omj/IrGGvKvQAzDzGMC0R4x8qD6FJsXjgFXeTdVoM7U9+
N/sMc1v9oMuzqnCUB6aYPjiowhFWTydCNx2Axs1vfPnFV/yVmtEx2zOVV0xymgQA
pl/NMaBq6QGYUFhw9sOq6HKzHNdOf00zf4jgJkNMTXQFuN0ORqHcTM0sgFh5uL3q
mh4TqluVO6ubq0Y8ORaIc4Nxzy0VY7B/VOr9izWCHwMTzaqrZgBAPEH7mc72rFV8
oTBLLnRmdyi/SFreL5WRhMm67DHne08LCqnkzEVwMIUECN5f2mkx9KP3BrsXuH2W
+1hKj+xMws8oZdLouSmo84Ie31cjBbgss/lWzauDkFVcJ7wZXi4xAxL/sCDIu/+y
sxMmX+s/PapsdSyUJ2g3hAf6Iv5m0pcUeQ==
-----END NEW CERTIFICATE REQUEST-----'''
response = requests.post('http://localhost:8080/api/auth/device',headers=header,data=json.dumps(data))
print(response.status_code)
print(response.text)
print(token)
response = requests.get("http://localhost:8080/api/nameserver/name/aberaud",headers=header)
print(response.status_code)
print(response.text)
response = requests.get("http://localhost:8080//api/auth/directories",headers=header)
print(response.status_code)
print(response.text)
response = requests.get("http://localhost:8080/api/auth/user",headers=header)
print(response.status_code)
print(response.text)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment