# Path: voeventdb/server/tests/fixtures/packetgen.py
# def generate_stream_id():
# def create_skeleton_voevent(id, stream, role, author_date):
# def create_test_packet(id, author_date, role):
# def create_basic_location_alert(id,
#                                 role,
#                                 author_datetime,
#                                 description,
#                                 ra, dec, err,
#                                 event_datetime):
# def timerange(start, end, interval):
# 
# Path: voeventdb/server/tests/fixtures/testpacket_id.py
# class id_keys:


from voeventdb.server.tests.fixtures import packetgen
from voeventdb.server.tests.fixtures.testpacket_id import testpacket_identity
from datetime import datetime, timedelta
import voeventparse as vp
import pytz

default_start_dt = datetime(2015, 1, 1, tzinfo=pytz.UTC)

def heartbeat_packets(start=default_start_dt,
                      interval=timedelta(minutes=15),
                      n_packets=24,
                      role=vp.definitions.roles.test):
    """
    Create Voevents with varying ivorns and values of ``Who.Date``.

    Args:
        start(datetime.datetime): Start time.
        end(datetime.datetime): End time (non-inclusive).
        interval(datetime.timedelta): Heartbeat interval.
    Returns:
        packets: A list of VOEvent packets.
    """
    packets = []
    for ts in packetgen.timerange(start,start+n_packets*interval,interval):

# Path: voeventdb/server/tests/fixtures/packetgen.py
# def generate_stream_id():
# def create_skeleton_voevent(id, stream, role, author_date):
# def create_test_packet(id, author_date, role):
# def create_basic_location_alert(id,
#                                 role,
#                                 author_datetime,
#                                 description,
#                                 ra, dec, err,
#                                 event_datetime):
# def timerange(start, end, interval):
# 
# Path: voeventdb/server/tests/fixtures/testpacket_id.py
# class id_keys:


# Path: voeventdb/server/tests/fixtures/fake.py
from voeventdb.server.tests.fixtures import packetgen
from voeventdb.server.tests.fixtures.testpacket_id import testpacket_identity
from datetime import datetime, timedelta
import voeventparse as vp
import pytz


default_start_dt = datetime(2015, 1, 1, tzinfo=pytz.UTC)

def heartbeat_packets(start=default_start_dt,
                      interval=timedelta(minutes=15),
                      n_packets=24,
                      role=vp.definitions.roles.test):
    """
    Create Voevents with varying ivorns and values of ``Who.Date``.

    Args:
        start(datetime.datetime): Start time.
        end(datetime.datetime): End time (non-inclusive).
        interval(datetime.timedelta): Heartbeat interval.
    Returns:
        packets: A list of VOEvent packets.
    """
    packets = []
    for ts in packetgen.timerange(start,start+n_packets*interval,interval):

        packets.append(packetgen.create_test_packet(testpacket_identity,