Exemplo n.º 1
0
def test_remove_checkpoint_group_members(pg_conn, ckp_a1, ckp_a2):
    create_checkpoint_group(pg_conn, 'group-1')
    add_checkpoint_group_member(pg_conn, 'group-1', ckp_a1)
    add_checkpoint_group_member(pg_conn, 'group-1', ckp_a2)
    remove_checkpoint_group_members(pg_conn, 'group-1', (ckp_a1, ))
    rs = retrieve_checkpoint_group_members(pg_conn, 'group-1')
    assert rs == [{'checkpoint_id': ckp_a2, 'checkpoint_name': 'ckp_a2'}]
Exemplo n.º 2
0
def test_retrieve_all_checkpoint_groups(pg_conn):
    dql_binds.create_checkpoint_group(pg_conn, 'group-2')
    dql_binds.create_checkpoint_group(pg_conn, 'group-1')
    records = dql_binds.retrieve_all_checkpoint_groups(pg_conn)
    assert (len(records) == 2)
    assert (records[0]['group_name'] == 'group-1')
    assert (records[1]['group_name'] == 'group-2')
Exemplo n.º 3
0
def test_retrieve_checkpoint_groups_by_checkpoint_id(pg_conn, ckp_a1):
    create_checkpoint_group(pg_conn, 'group-1')
    create_checkpoint_group(pg_conn, 'group-2')
    add_checkpoint_group_member(pg_conn, 'group-1', ckp_a1)
    add_checkpoint_group_member(pg_conn, 'group-2', ckp_a1)
    rs = retrieve_checkpoint_groups_by_checkpoint_id(pg_conn, ckp_a1)
    assert rs == [{'group_name': 'group-1'}, {'group_name': 'group-2'}]
Exemplo n.º 4
0
def test_delete_checkpoint_groups_by_group_names(pg_conn):
    create_checkpoint_group(pg_conn, 'group-1')
    rs = retrieve_all_checkpoint_groups(pg_conn)
    assert len(rs) == 1
    delete_checkpoint_groups_by_group_names(pg_conn, ('group-1', ))
    rs = retrieve_all_checkpoint_groups(pg_conn)
    assert rs == []
Exemplo n.º 5
0
def test_retrieve_all_checkpoint_groups(pg_conn):
    create_checkpoint_group(pg_conn, 'group-1')
    create_checkpoint_group(pg_conn, 'group-2')
    rs = retrieve_all_checkpoint_groups(pg_conn)
    assert len(rs) == 2
    assert rs[0]['group_name'] == 'group-1'
    assert rs[1]['group_name'] == 'group-2'
Exemplo n.º 6
0
def test_add_checkpoint_group_member(pg_conn):
    created_group_name = dql_binds.create_checkpoint_group(
        pg_conn, group_name='group-1')
    created_checkpoint_id = dql_binds.create_checkpoint(pg_conn, 'Entrance A')
    result = dql_binds.add_checkpoint_group_member(pg_conn, created_group_name,
                                                   created_checkpoint_id)
    assert result is None
Exemplo n.º 7
0
def test_retrieve_checkpoint_groups_by_checkpoint_id(pg_conn):
    created_group_name = dql_binds.create_checkpoint_group(
        pg_conn, group_name='group-1')
    created_checkpoint_id = dql_binds.create_checkpoint(pg_conn, 'Entrance A')
    dql_binds.add_checkpoint_group_member(pg_conn, created_group_name,
                                          created_checkpoint_id)
    records = dql_binds.retrieve_checkpoint_groups_by_checkpoint_id(
        pg_conn, created_checkpoint_id)
    assert len(records) == 1
    assert records[0]['group_name'] == 'group-1'
Exemplo n.º 8
0
def test_remove_checkpoint_from_checkpoint_groups(pg_conn, ckp_a1, ckp_a2):
    create_checkpoint_group(pg_conn, 'group-1')
    create_checkpoint_group(pg_conn, 'group-2')
    create_checkpoint_group(pg_conn, 'group-3')
    add_checkpoint_group_member(pg_conn, 'group-1', ckp_a1)
    add_checkpoint_group_member(pg_conn, 'group-2', ckp_a1)
    add_checkpoint_group_member(pg_conn, 'group-3', ckp_a1)
    add_checkpoint_group_member(pg_conn, 'group-1', ckp_a2)
    remove_checkpoint_from_checkpoint_groups(pg_conn, ckp_a1,
                                             ('group-1', 'group-3'))
    rs = retrieve_checkpoint_groups_by_checkpoint_id(pg_conn, ckp_a1)
    assert rs == [{'group_name': 'group-2'}]
    rs = retrieve_checkpoint_groups_by_checkpoint_id(pg_conn, ckp_a2)
    assert rs == [{'group_name': 'group-1'}]
Exemplo n.º 9
0
def test_delete_checkpoint_groups_by_group_names(pg_conn):
    created_name = dql_binds.create_checkpoint_group(pg_conn, 'group-1')
    result = dql_binds.delete_checkpoint_groups_by_group_names(
        pg_conn, (created_name, ))
    assert result is None
Exemplo n.º 10
0
def test_update_checkpoint_group(pg_conn):
    created_name = dql_binds.create_checkpoint_group(pg_conn, 'group-1')
    result = dql_binds.update_checkpoint_group(pg_conn,
                                               group_name=created_name,
                                               new_group_name='group-2')
    assert result is None
Exemplo n.º 11
0
def test_create_checkpoint_group(pg_conn):
    created_name = dql_binds.create_checkpoint_group(pg_conn,
                                                     group_name='group-1')
    assert (isinstance(created_name, str))
Exemplo n.º 12
0
def ckpgrp_b(pg_conn):
    return create_checkpoint_group(pg_conn, 'ckpgrp_b')
Exemplo n.º 13
0
def test_create_checkpoint_group(pg_conn):
    create_checkpoint_group(pg_conn, 'group-1')
Exemplo n.º 14
0
def test_add_checkpoint_group_member(pg_conn, ckp_a1):
    create_checkpoint_group(pg_conn, 'group-1')
    add_checkpoint_group_member(pg_conn, 'group-1', ckp_a1)
Exemplo n.º 15
0
def test_update_checkpoint_group(pg_conn):
    create_checkpoint_group(pg_conn, 'group-1')
    update_checkpoint_group(pg_conn, 'group-1', 'group-a')
    rs = retrieve_all_checkpoint_groups(pg_conn)
    assert rs[0]['group_name'] == 'group-a'