Changeset View
Changeset View
Standalone View
Standalone View
swh/web/tests/data.py
Show First 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | |||||
def random_sha256(): | def random_sha256(): | ||||
return hash_to_hex(bytes(random.randint(0, 255) for _ in range(32))) | return hash_to_hex(bytes(random.randint(0, 255) for _ in range(32))) | ||||
def random_blake2s256(): | def random_blake2s256(): | ||||
return hash_to_hex(bytes(random.randint(0, 255) for _ in range(32))) | return hash_to_hex(bytes(random.randint(0, 255) for _ in range(32))) | ||||
def random_object_type(): | |||||
return random.choice( | |||||
[ | |||||
ObjectType.CONTENT, | |||||
ObjectType.DIRECTORY, | |||||
ObjectType.REVISION, | |||||
ObjectType.RELEASE, | |||||
ObjectType.SNAPSHOT, | |||||
vlorentz: this is dead code now | |||||
Done Inline ActionsSure. I misinterpreted you before thinking it would be good ot have anyways. Will remove. Ericson2314: Sure. I misinterpreted you before thinking it would be good ot have anyways. Will remove. | |||||
] | |||||
) | |||||
def random_swhid(): | |||||
return CoreSWHID( | |||||
object_type=random_object_type(), | |||||
object_id=random_sha1(), | |||||
) | |||||
def random_content(): | def random_content(): | ||||
return { | return { | ||||
"sha1": random_sha1(), | "sha1": random_sha1(), | ||||
"sha1_git": random_sha1(), | "sha1_git": random_sha1(), | ||||
"sha256": random_sha256(), | "sha256": random_sha256(), | ||||
"blake2s256": random_blake2s256(), | "blake2s256": random_blake2s256(), | ||||
} | } | ||||
▲ Show 20 Lines • Show All 473 Lines • Show Last 20 Lines |
this is dead code now