# Path: app/sync.py
# EC = EnjoliverConfig(importer=__file__)
# class ConfigSyncSchedules(object):
#     def __init__(self, api_uri: str, matchbox_path: str, ignition_dict: dict, extra_selector_dict=None):
#     def _reporting_ignitions(self):
#     def get_dns_attr(fqdn: str):
#     def cni_ipam(host_cidrv4: str, host_gateway: str):
#     def get_first_ip_address(ip_range: str):
#     def get_extra_selectors(extra_selectors: dict):
#     def etcd_member_ip_list(self):
#     def kubernetes_control_plane_ip_list(self):
#     def kubernetes_nodes_ip_list(self):
#     def order_http_uri(ips: list, ec_value: int, secure=False):
#     def order_etcd_named(ips: list, ec_value: int, secure=False):
#     def kubernetes_etcd_initial_cluster(self):
#     def vault_etcd_initial_cluster(self):
#     def fleet_etcd_initial_cluster(self):
#     def kubernetes_etcd_member_client_uri_list(self):
#     def vault_etcd_member_client_uri_list(self):
#     def fleet_etcd_member_client_uri_list(self):
#     def kubernetes_etcd_member_peer_uri_list(self):
#     def vault_etcd_member_peer_uri_list(self):
#     def fleet_etcd_member_peer_uri_list(self):
#     def kubernetes_control_plane(self):
#     def compute_disks_size(disks: list):
#     def produce_matchbox_data(self, marker: str, i: int, m: dict, automatic_name: str, update_extra_metadata=None):
#     def etcd_member_kubernetes_control_plane(self):
#     def kubernetes_nodes(self):
#     def notify(self):
#     def apply(self, nb_try=2, seconds_sleep=0):
#     def _query_roles(self, *roles):
#     def _query_ip_list(self, role):


import json
import os
from unittest import TestCase
from app import sync
    def test_04(self):
        s = sync.ConfigSyncSchedules(
            api_uri=self.api_uri,
            matchbox_path=self.test_matchbox_path,
            ignition_dict={},
            extra_selector_dict=None,
        )

        sync.ConfigSyncSchedules.range_nb_ips = 60
        sync.ConfigSyncSchedules.skip_ips = 1
        sync.ConfigSyncSchedules.sub_ips = 0

        d = s.cni_ipam("10.99.33.1/19", "10.99.64.254")
        self.assertEqual(json.dumps({
            "dataDir": "/var/lib/cni/networks",
            "type": "host-local",
            "subnet": "10.99.32.0/19",
            "rangeStart": "10.99.33.2",
            "rangeEnd": "10.99.33.62",
            "gateway": "10.99.64.254",
            "routes": [
                {"dst": "172.30.0.0/24", "gw": "10.99.33.1"},
                {"dst": "0.0.0.0/0"},
            ]}, indent=2, sort_keys=True), json.dumps(d, indent=2, sort_keys=True))

    def test_04_1(self):
        s = sync.ConfigSyncSchedules(
            api_uri=self.api_uri,
            matchbox_path=self.test_matchbox_path,
            ignition_dict={},

# Path: app/sync.py
# EC = EnjoliverConfig(importer=__file__)
# class ConfigSyncSchedules(object):
#     def __init__(self, api_uri: str, matchbox_path: str, ignition_dict: dict, extra_selector_dict=None):
#     def _reporting_ignitions(self):
#     def get_dns_attr(fqdn: str):
#     def cni_ipam(host_cidrv4: str, host_gateway: str):
#     def get_first_ip_address(ip_range: str):
#     def get_extra_selectors(extra_selectors: dict):
#     def etcd_member_ip_list(self):
#     def kubernetes_control_plane_ip_list(self):
#     def kubernetes_nodes_ip_list(self):
#     def order_http_uri(ips: list, ec_value: int, secure=False):
#     def order_etcd_named(ips: list, ec_value: int, secure=False):
#     def kubernetes_etcd_initial_cluster(self):
#     def vault_etcd_initial_cluster(self):
#     def fleet_etcd_initial_cluster(self):
#     def kubernetes_etcd_member_client_uri_list(self):
#     def vault_etcd_member_client_uri_list(self):
#     def fleet_etcd_member_client_uri_list(self):
#     def kubernetes_etcd_member_peer_uri_list(self):
#     def vault_etcd_member_peer_uri_list(self):
#     def fleet_etcd_member_peer_uri_list(self):
#     def kubernetes_control_plane(self):
#     def compute_disks_size(disks: list):
#     def produce_matchbox_data(self, marker: str, i: int, m: dict, automatic_name: str, update_extra_metadata=None):
#     def etcd_member_kubernetes_control_plane(self):
#     def kubernetes_nodes(self):
#     def notify(self):
#     def apply(self, nb_try=2, seconds_sleep=0):
#     def _query_roles(self, *roles):
#     def _query_ip_list(self, role):


# Path: app/tests/unit/test_sync.py
import json
import os
from unittest import TestCase
from app import sync

    def test_04(self):
        s = sync.ConfigSyncSchedules(
            api_uri=self.api_uri,
            matchbox_path=self.test_matchbox_path,
            ignition_dict={},
            extra_selector_dict=None,
        )

        sync.ConfigSyncSchedules.range_nb_ips = 60
        sync.ConfigSyncSchedules.skip_ips = 1
        sync.ConfigSyncSchedules.sub_ips = 0

        d = s.cni_ipam("10.99.33.1/19", "10.99.64.254")
        self.assertEqual(json.dumps({
            "dataDir": "/var/lib/cni/networks",
            "type": "host-local",
            "subnet": "10.99.32.0/19",
            "rangeStart": "10.99.33.2",
            "rangeEnd": "10.99.33.62",
            "gateway": "10.99.64.254",
            "routes": [
                {"dst": "172.30.0.0/24", "gw": "10.99.33.1"},
                {"dst": "0.0.0.0/0"},
            ]}, indent=2, sort_keys=True), json.dumps(d, indent=2, sort_keys=True))

    def test_04_1(self):
        s = sync.ConfigSyncSchedules(
            api_uri=self.api_uri,
            matchbox_path=self.test_matchbox_path,
            ignition_dict={},

            extra_selector_dict=None,