Skip to content
Snippets Groups Projects
Commit a78d71fe authored by JORGE SASIAIN's avatar JORGE SASIAIN
Browse files

create conftest.py

parent 07633cce
No related branches found
No related tags found
1 merge request!9Ipam service
import contextlib
import json
import os
import socket
import pytest
import tempfile
@pytest.fixture(scope='session')
def configuration_data():
with contextlib.closing(
socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as s:
s.bind(('', 0))
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
yield {
"GENERAL": {
"public_hostname": "https://gap.geant.org"
},
"RESOURCE_MANAGER_API_PREFIX": "http://localhost:44444",
"IPAM": {
"INFOBLOX": {
"scheme": "https",
"wapi_version": "v2.12",
"host": "10.0.0.1",
"username": "robot-user",
"password": "robot-user-password"
},
"LO": {
"V4": {"containers": ["10.255.255.0/24"], "mask": 32},
"V6": {"containers": ["dead:beef::/64"], "mask": 128},
"domain_name": ".lo"
},
"TRUNK": {
"V4": {
"containers": ["10.255.255.0/24", "10.255.254.0/24"],
"mask": 31
},
"V6": {
"containers": ["dead:beef::/64", "dead:beee::/64"],
"mask": 126
},
"domain_name": ".trunk"
},
"GEANT_IP": {
"V4": {
"containers": ["10.255.255.0/24", "10.255.254.0/24"],
"mask": 31
},
"V6": {
"containers": ["dead:beef::/64", "dead:beee::/64"],
"mask": 126
},
"domain_name": ".geantip"
}
},
"PROVISIONING_PROXY": {
"scheme": "https",
"api_base": "localhost:44444",
"auth": "Bearer <token>",
"api_version": 1123
}
}
@pytest.fixture(scope='session')
def data_config_filename(configuration_data):
file_name = os.path.join(
tempfile.gettempdir(), os.urandom(24).hex())
open(file_name, 'x').close()
with open(file_name, 'wb') as f:
f.write(json.dumps(configuration_data).encode('utf-8'))
f.flush()
os.environ['OSS_PARAMS_FILENAME'] = f.name
yield f.name
import contextlib
import ipaddress
import json
import os
import socket
import pytest
import re
import responses
import tempfile
from gso.services import ipam
@pytest.fixture(scope='session')
def configuration_data():
with contextlib.closing(
socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as s:
s.bind(('', 0))
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
yield {
"GENERAL": {
"public_hostname": "https://gap.geant.org"
},
"RESOURCE_MANAGER_API_PREFIX": "http://localhost:44444",
"IPAM": {
"INFOBLOX": {
"scheme": "https",
"wapi_version": "v2.12",
"host": "10.0.0.1",
"username": "robot-user",
"password": "robot-user-password"
},
"LO": {
"V4": {"containers": ["10.255.255.0/24"], "mask": 32},
"V6": {"containers": ["dead:beef::/64"], "mask": 128},
"domain_name": ".lo"
},
"TRUNK": {
"V4": {
"containers": ["10.255.255.0/24", "10.255.254.0/24"],
"mask": 31
},
"V6": {
"containers": ["dead:beef::/64", "dead:beee::/64"],
"mask": 126
},
"domain_name": ".trunk"
},
"GEANT_IP": {
"V4": {
"containers": ["10.255.255.0/24", "10.255.254.0/24"],
"mask": 31
},
"V6": {
"containers": ["dead:beef::/64", "dead:beee::/64"],
"mask": 126
},
"domain_name": ".geantip"
}
},
"PROVISIONING_PROXY": {
"scheme": "https",
"api_base": "localhost:44444",
"auth": "Bearer <token>",
"api_version": 1123
}
}
@pytest.fixture(scope='session')
def data_config_filename(configuration_data):
file_name = os.path.join(
tempfile.gettempdir(), os.urandom(24).hex())
open(file_name, 'x').close()
with open(file_name, 'wb') as f:
f.write(json.dumps(configuration_data).encode('utf-8'))
f.flush()
os.environ['OSS_PARAMS_FILENAME'] = f.name
yield f.name
@responses.activate
def test_new_service_networks(data_config_filename, service_type='LO'):
......
# just a placeholder to be able to run tests during ci
def test_placeholder():
pass
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