Beispiel #1
0
def generate_test_aol():
    """Return an AOL list of Appendable (tuple) instances
    (encoding 2 ``OLDInstance``s).
    """
    test_old_instance_1, err = domain.construct_old_instance(
        slug='oka',
        name='Okanagan OLD',
        url='http://127.0.0.1:5679/oka',
        leader='',
        state=domain.NOT_SYNCED_STATE,
        is_auto_syncing=False)
    test_old_instance_2, err = domain.construct_old_instance(
        slug='bla',
        name='Blackfoot OLD',
        url='http://127.0.0.1:5679/bla',
        leader='',
        state=domain.NOT_SYNCED_STATE,
        is_auto_syncing=False)
    test_old_instance_1_quads = aol_mod.instance_to_quads(
        test_old_instance_1, domain.OLD_INSTANCE_TYPE)
    test_old_instance_2_quads = aol_mod.instance_to_quads(
        test_old_instance_2, domain.OLD_INSTANCE_TYPE)
    aol = []
    for quad in test_old_instance_1_quads + test_old_instance_2_quads:
        aol = aol_mod.append_to_aol(aol, quad)
    return aol
Beispiel #2
0
def generate_test_aol():
    """Return an AOL encoding 2 OLDInstances, 1 DativeApp and 1 OLDService
    """
    old_instance_1, _ = domain.construct_old_instance(
        slug='oka',
        name='Okanagan OLD',
        url='http://127.0.0.1:5679/oka',
        leader='',
        state=domain.NOT_SYNCED_STATE,
        is_auto_syncing=False)
    old_instance_2, _ = domain.construct_old_instance(
        slug='bla',
        name='Blackfoot OLD',
        url='http://127.0.0.1:5679/bla',
        leader='',
        state=domain.NOT_SYNCED_STATE,
        is_auto_syncing=False)
    dative_app, _ = domain.construct_dative_app(
        url='http://127.0.0.1:5678/')
    old_service, _ = domain.construct_old_service(
        url='http://127.0.0.1:5679/')
    old_instance_1_quads = aol_mod.instance_to_quads(
        old_instance_1, domain.OLD_INSTANCE_TYPE)
    old_instance_2_quads = aol_mod.instance_to_quads(
        old_instance_2, domain.OLD_INSTANCE_TYPE)
    dative_app_quads = aol_mod.instance_to_quads(
        dative_app, domain.DATIVE_APP_TYPE)
    old_service_quads = aol_mod.instance_to_quads(
        old_service, domain.OLD_SERVICE_TYPE)
    quads = (
        old_instance_1_quads +
        old_instance_2_quads +
        dative_app_quads +
        old_service_quads)
    aol = []
    for quad in quads:
        aol = aol_mod.append_to_aol(aol, quad)
    domain_entities = {
        'old-instances': set([old_instance_1, old_instance_2]),
        'dative-apps': set([dative_app]),
        'old-services': set([old_service]),
    }
    return aol, domain_entities
Beispiel #3
0
def generate_large_test_aol(n_old_instances):
    """Return an AOL enxoding ``n_old_instances`` OLDInstances."""
    aol = []
    for _ in range(n_old_instances):
        test_old_instance, err = domain.construct_old_instance(
            slug='oka',
            name='Okanagan OLD',
            url='http://127.0.0.1:5679/oka',
            leader='',
            state=domain.NOT_SYNCED_STATE,
            is_auto_syncing=False)
        for quad in aol_mod.instance_to_quads(
                test_old_instance, domain.OLD_INSTANCE_TYPE):
            aol = aol_mod.append_to_aol(aol, quad)
    return aol
Beispiel #4
0
def generate_oi_quads():
    """Return a list of quads representing a single OI, OLDInstance.
    """
    old_instance, err = domain.construct_old_instance(
        slug='oka',
        name='Okanagan OLD',
        url='http://127.0.0.1:5679/oka',
        leader='',
        state=domain.NOT_SYNCED_STATE,
        is_auto_syncing=False)
    old_instance_quads = aol_mod.instance_to_quads(
        old_instance, domain.OLD_INSTANCE_TYPE)
    aol = []
    for quad in old_instance_quads:
        aol = aol_mod.append_to_aol(aol, quad)
    return aol
Beispiel #5
0
def test_old_instance_construction(kwargs, error):
    _, err = domain.construct_old_instance(**kwargs)
    assert err == error