Ejemplo n.º 1
0
def test_organisation_create(app, db, org_martigny_data, org_sion_data):
    """Test organisation creation."""
    org_martigny_data['pid'] = '1'
    org = Organisation.create(org_martigny_data, dbcommit=True, reindex=True)
    assert org == org_martigny_data
    assert org.get('pid') == '1'

    assert org.get_links_to_me() == {}
    assert org.can_delete

    org = Organisation.get_record_by_pid('1')
    assert org == org_martigny_data

    fetched_pid = fetcher(org.id, org)
    assert fetched_pid.pid_value == '1'
    assert fetched_pid.pid_type == 'org'

    org_sion_data['pid'] = '2'
    org = Organisation.create(
        org_sion_data, dbcommit=True, reindex=True)
    assert org.get('pid') == '2'

    identifier = Organisation.provider.identifier
    append_fixtures_new_identifiers(identifier, ['1', '2'])
    assert identifier.next() == identifier.max() == 3
Ejemplo n.º 2
0
def test_organisation_create(app, db, org_martigny_data):
    """Test organisation creation."""
    org = Organisation.create(org_martigny_data, delete_pid=True)
    assert org == org_martigny_data
    assert org.get('pid') == '1'

    assert org.get_links_to_me() == {}
    assert org.can_delete

    org = Organisation.get_record_by_pid('1')
    assert org == org_martigny_data

    fetched_pid = fetcher(org.id, org)
    assert fetched_pid.pid_value == '1'
    assert fetched_pid.pid_type == 'org'