# Path: ipwb/util.py
# IPFSAPI_MUTLIADDRESS = '/dns/localhost/tcp/5001/http'
# IPWBREPLAY_ADDRESS = 'localhost:5000'
# (IPWBREPLAY_HOST, IPWBREPLAY_PORT) = IPWBREPLAY_ADDRESS.split(':')
# IPWBREPLAY_PORT = int(IPWBREPLAY_PORT)
# INDEX_FILE = os.path.join('samples', 'indexes', 'salam-home.cdxj')
#         Y = match.group(1)
#         H = match.group(4) or '00'
#         M = match.group(5) or '00'
#         S = match.group(6) or '00'
# def create_ipfs_client(daemonMultiaddr=IPFSAPI_MUTLIADDRESS):
# def ipfs_client(daemonMultiaddr=IPFSAPI_MUTLIADDRESS):
# def check_daemon_is_alive(daemonMultiaddr=IPFSAPI_MUTLIADDRESS):
# def is_valid_cdxj(stringIn):  # TODO: Check specific strict syntax
# def is_valid_cdxj_line(cdxj_line):
# def compare_versions(versionA, versionB):
# def is_cdxj_metadata_record(cdxj_line):
# def is_localhosty(uri):
# def set_locale():
# def digits14_to_rfc1123(digits14):
# def rfc1123_to_digits14(rfc1123_datestring):
# def iso8601_to_digits14(iso8601DateString):
# def is_rfc1123_compliant(dtstr):
# def get_rfc1123_of_now():
# def pad_digits14(dtstr, validate=False):
# def fetch_remote_file(path):
# def read_ipfs_config():
# def write_ipfs_config(json_to_write):
# def get_ipfsapi_host_and_port(ipfs_json=None):
# def get_ipwb_replay_config(ipfs_json=None):
# def set_ipwb_replay_config(Host, Port, ipfs_json=None):
# def set_ipwb_replay_index_path(cdxj):
# def get_ipwb_replay_index_path():
# def unsurt(surt):
# def get_latest_version():
# def check_for_update(_):


import pytest
from ipwb import util
    ('20181126134257.123', '20181126134257.123'),
    ('20180101000000', '2018'),
    ('20181101000000', '201811'),
    ('20181126000000', '20181126'),
    ('20181126130000', '2018112613'),
    ('20181126134200', '201811261342'),
    ('20181126134257', '20181126134257'),
])
def test_pad_digits14(expected, input):
    assert expected == util.pad_digits14(input)


@pytest.mark.parametrize('input', [
    '',
    'foo',
    '18',
    '201l',
    '2018010100000O',
    '20181',
    '201800',
    '20180132',
    '2018010226',
    '20181301000000',
    '20180932000000',
    '20180230000000',
    '20180102263127',
    '20181126134257.123',
])
def test_pad_digits14_inalid(input):
    with pytest.raises(ValueError):

# Path: ipwb/util.py
# IPFSAPI_MUTLIADDRESS = '/dns/localhost/tcp/5001/http'
# IPWBREPLAY_ADDRESS = 'localhost:5000'
# (IPWBREPLAY_HOST, IPWBREPLAY_PORT) = IPWBREPLAY_ADDRESS.split(':')
# IPWBREPLAY_PORT = int(IPWBREPLAY_PORT)
# INDEX_FILE = os.path.join('samples', 'indexes', 'salam-home.cdxj')
#         Y = match.group(1)
#         H = match.group(4) or '00'
#         M = match.group(5) or '00'
#         S = match.group(6) or '00'
# def create_ipfs_client(daemonMultiaddr=IPFSAPI_MUTLIADDRESS):
# def ipfs_client(daemonMultiaddr=IPFSAPI_MUTLIADDRESS):
# def check_daemon_is_alive(daemonMultiaddr=IPFSAPI_MUTLIADDRESS):
# def is_valid_cdxj(stringIn):  # TODO: Check specific strict syntax
# def is_valid_cdxj_line(cdxj_line):
# def compare_versions(versionA, versionB):
# def is_cdxj_metadata_record(cdxj_line):
# def is_localhosty(uri):
# def set_locale():
# def digits14_to_rfc1123(digits14):
# def rfc1123_to_digits14(rfc1123_datestring):
# def iso8601_to_digits14(iso8601DateString):
# def is_rfc1123_compliant(dtstr):
# def get_rfc1123_of_now():
# def pad_digits14(dtstr, validate=False):
# def fetch_remote_file(path):
# def read_ipfs_config():
# def write_ipfs_config(json_to_write):
# def get_ipfsapi_host_and_port(ipfs_json=None):
# def get_ipwb_replay_config(ipfs_json=None):
# def set_ipwb_replay_config(Host, Port, ipfs_json=None):
# def set_ipwb_replay_index_path(cdxj):
# def get_ipwb_replay_index_path():
# def unsurt(surt):
# def get_latest_version():
# def check_for_update(_):


# Path: tests/test_util.py
import pytest
from ipwb import util

    ('20181126134257.123', '20181126134257.123'),
    ('20180101000000', '2018'),
    ('20181101000000', '201811'),
    ('20181126000000', '20181126'),
    ('20181126130000', '2018112613'),
    ('20181126134200', '201811261342'),
    ('20181126134257', '20181126134257'),
])
def test_pad_digits14(expected, input):
    assert expected == util.pad_digits14(input)


@pytest.mark.parametrize('input', [
    '',
    'foo',
    '18',
    '201l',
    '2018010100000O',
    '20181',
    '201800',
    '20180132',
    '2018010226',
    '20181301000000',
    '20180932000000',
    '20180230000000',
    '20180102263127',
    '20181126134257.123',
])
def test_pad_digits14_inalid(input):
    with pytest.raises(ValueError):

        util.pad_digits14(input, validate=True)