# Path: spec/python/db_connection.py
# TEST_DATABASE_MYSQL = 'samapper_test'
# TEST_DATABASE_SQLITE = '/tmp/sam_test.db'
# class Mocker(object):
# class Session(dict):
# class env(object):
#     def __init__(self, *args, **kwargs):
#     def __getitem__(self, k):
#     def __setitem__(self, k, v):
#     def __getattr__(self, name):
#         def receiver(*args, **kwargs):
#     def __call__(self, *args, **kwargs):
#     def clear(self):
#     def was_called(self, name, *args, **kwargs):
#     def kill(self):
#     def __init__(self, mock_input=False, login_active=None, mock_session=False, mock_render=False, lang='en'):
#     def __enter__(self):
#     def __exit__(self, type, value, traceback):
# def make_timestamp(timestring):
# def unix_timestamp_to_datetime(stamp):
# def get_test_db_connection():
# def setup_datasources(db, sub_id):
# def template_sql(path, *args):
# def setup_network(db, sub_id, ds_id):
# def setup_node_extras(sub_id):
# 
# Path: sam/constants.py
# LDAP = {
#     'connection_string': config.get('LDAP', 'connection_string', default='')
# }
# def enable_local_mode():
# def init_urls():
# def find_url(target):
# def get_navbar(lang):


from spec.python import db_connection
from sam.local import en as strings
from sam import constants
import web
import sam.pages.details
import json
import urllib
    nice = sam.pages.details.Details.nice_ip_address('10.20.30.40')
    assert nice == '10.20.30.40/32'
    nice = sam.pages.details.Details.nice_ip_address('11.22.33.44/0')
    assert nice == '0.0.0.0/0'
    nice = sam.pages.details.Details.nice_ip_address('11.22.33.44/8')
    assert nice == '11.0.0.0/8'
    nice = sam.pages.details.Details.nice_ip_address('11.22.33.44/16')
    assert nice == '11.22.0.0/16'
    nice = sam.pages.details.Details.nice_ip_address('11.22.33.44/24')
    assert nice == '11.22.33.0/24'
    nice = sam.pages.details.Details.nice_ip_address('11.22.33.44/32')
    assert nice == '11.22.33.44/32'

# ---------------------------------------------------------


def simplify(data):
    tup = (
        int(data['unique_in']),
        int(data['unique_out']),
        int(data['unique_ports']),
        len(data['inputs']['rows']),
        len(data['outputs']['rows']),
        len(data['ports']['rows']),
    )
    return tup


def test_simple_request0():
    with db_connection.env(mock_session=True):

# Path: spec/python/db_connection.py
# TEST_DATABASE_MYSQL = 'samapper_test'
# TEST_DATABASE_SQLITE = '/tmp/sam_test.db'
# class Mocker(object):
# class Session(dict):
# class env(object):
#     def __init__(self, *args, **kwargs):
#     def __getitem__(self, k):
#     def __setitem__(self, k, v):
#     def __getattr__(self, name):
#         def receiver(*args, **kwargs):
#     def __call__(self, *args, **kwargs):
#     def clear(self):
#     def was_called(self, name, *args, **kwargs):
#     def kill(self):
#     def __init__(self, mock_input=False, login_active=None, mock_session=False, mock_render=False, lang='en'):
#     def __enter__(self):
#     def __exit__(self, type, value, traceback):
# def make_timestamp(timestring):
# def unix_timestamp_to_datetime(stamp):
# def get_test_db_connection():
# def setup_datasources(db, sub_id):
# def template_sql(path, *args):
# def setup_network(db, sub_id, ds_id):
# def setup_node_extras(sub_id):
# 
# Path: sam/constants.py
# LDAP = {
#     'connection_string': config.get('LDAP', 'connection_string', default='')
# }
# def enable_local_mode():
# def init_urls():
# def find_url(target):
# def get_navbar(lang):


# Path: spec/python/pages/test_details.py
from spec.python import db_connection
from sam.local import en as strings
from sam import constants
import web
import sam.pages.details
import json
import urllib

    nice = sam.pages.details.Details.nice_ip_address('10.20.30.40')
    assert nice == '10.20.30.40/32'
    nice = sam.pages.details.Details.nice_ip_address('11.22.33.44/0')
    assert nice == '0.0.0.0/0'
    nice = sam.pages.details.Details.nice_ip_address('11.22.33.44/8')
    assert nice == '11.0.0.0/8'
    nice = sam.pages.details.Details.nice_ip_address('11.22.33.44/16')
    assert nice == '11.22.0.0/16'
    nice = sam.pages.details.Details.nice_ip_address('11.22.33.44/24')
    assert nice == '11.22.33.0/24'
    nice = sam.pages.details.Details.nice_ip_address('11.22.33.44/32')
    assert nice == '11.22.33.44/32'

# ---------------------------------------------------------


def simplify(data):
    tup = (
        int(data['unique_in']),
        int(data['unique_out']),
        int(data['unique_ports']),
        len(data['inputs']['rows']),
        len(data['outputs']['rows']),
        len(data['ports']['rows']),
    )
    return tup


def test_simple_request0():
    with db_connection.env(mock_session=True):

        app = web.application(constants.urls)