Ejemplo n.º 1
0
def test_gen_origins_max():
    nmax = len(ORIGINS)
    origins = gen_origins(nmax + 1)
    assert len(origins) == nmax
    models = {Origin.from_dict(d).url for d in origins}
    # ensure we did not generate the same origin twice
    assert len(origins) == len(models)
Ejemplo n.º 2
0
def test_gen_origins_default():
    origins = gen_origins()
    assert len(origins) == 100
    models = [Origin.from_dict(d).url for d in origins]
    assert len(origins) == len(set(models))
Ejemplo n.º 3
0
def swh_origins(swh_storage: StorageInterface) -> Iterable[Origin]:
    origins = [Origin.from_dict(o) for o in gen_origins(n=100)]
    swh_storage.origin_add(origins)
    return origins
Ejemplo n.º 4
0
def test_gen_origins_one():
    origins = gen_origins(1)
    assert len(origins) == 1
    assert [Origin.from_dict(d) for d in origins]
Ejemplo n.º 5
0
 def test_content_identifier(self):
     self.assertEqual(
         Origin.from_dict(origin_example).id,
         _x("b63a575fe3faab7692c9f38fb09d4bb45651bb0f"),
     )