summaryrefslogtreecommitdiff
path: root/tests/functional/api/test_bulk_imports.py
blob: 899d35840a8b52e719c4da8fac8c576e9044e516 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
def test_bulk_imports(gl, group):
    destination = f"{group.full_path}-import"
    configuration = {
        "url": gl.url,
        "access_token": gl.private_token,
    }
    migration_entity = {
        "source_full_path": group.full_path,
        "source_type": "group_entity",
        "destination_slug": destination,
        "destination_namespace": destination,
    }
    created_migration = gl.bulk_imports.create(
        {
            "configuration": configuration,
            "entities": [migration_entity],
        }
    )

    assert created_migration.source_type == "gitlab"
    assert created_migration.status == "created"

    migration = gl.bulk_imports.get(created_migration.id)
    assert migration == created_migration

    migration.refresh()
    assert migration == created_migration

    migrations = gl.bulk_imports.list()
    assert migration in migrations

    all_entities = gl.bulk_import_entities.list()
    entities = migration.entities.list()
    assert isinstance(entities, list)
    assert entities[0] in all_entities

    entity = migration.entities.get(entities[0].id)
    assert entity == entities[0]

    entity.refresh()
    assert entity.created_at == entities[0].created_at