Changeset View
Changeset View
Standalone View
Standalone View
swh/graphql/tests/data.py
Show First 20 Lines • Show All 120 Lines • ▼ Show 20 Lines | return [ | ||||
perms=0o644, | perms=0o644, | ||||
type="dir", | type="dir", | ||||
target=get_directories()[1].id, | target=get_directories()[1].id, | ||||
), | ), | ||||
) | ) | ||||
) | ) | ||||
] | ] | ||||
anlambert: s/speical/special/ | |||||
def get_directories_with_special_name_entries(): | |||||
return [ | |||||
Directory( | |||||
entries=( | |||||
DirectoryEntry( | |||||
Done Inline ActionsCould you use a more meaningful example as UTF-8 string and add a dedidcated test ? For instance casefold will turn german letter ß into ss. anlambert: Could you use a more meaningful example as UTF-8 string and add a dedidcated test ? For… | |||||
Done Inline Actionsb"\xc3\x9f\xc3\x9f\xc3\xa9tE\xc3\x89t".decode() == "ßßétEÉt" The tests are using "ßßétEÉ" to search. (It is generic with pytest. parametrize where name include is always entry_name[:-1]) jayeshv: b"\xc3\x9f\xc3\x9f\xc3\xa9tE\xc3\x89t".decode() == "ßßétEÉt"
The tests are using "ßßétEÉ" to… | |||||
Done Inline ActionsUse "ßßétEÉt".encode() then and add a test searching for "ss" in directory entry. anlambert: Use `"ßßétEÉt".encode()` then and add a test searching for `"ss"` in directory entry. | |||||
name="ßßétEÉt".encode(), | |||||
perms=0o644, | |||||
type="file", | |||||
target=get_contents()[0].sha1_git, | |||||
), | |||||
) | |||||
) | |||||
] | |||||
def get_visit_with_multiple_status(): | def get_visit_with_multiple_status(): | ||||
return [ | return [ | ||||
OriginVisitStatus( | OriginVisitStatus( | ||||
origin=get_origins()[0].url, | origin=get_origins()[0].url, | ||||
date=datetime.datetime(2014, 5, 7, 4, 20, 39, 432222, tzinfo=UTC), | date=datetime.datetime(2014, 5, 7, 4, 20, 39, 432222, tzinfo=UTC), | ||||
visit=1, | visit=1, | ||||
type="git", | type="git", | ||||
status="ongoing", | status="ongoing", | ||||
snapshot=None, | snapshot=None, | ||||
metadata=None, | metadata=None, | ||||
) | ) | ||||
] | ] | ||||
GRAPHQL_EXTRA_TEST_OBJECTS = { | GRAPHQL_EXTRA_TEST_OBJECTS = { | ||||
"release": get_releases_with_target(), | "release": get_releases_with_target(), | ||||
"revision": get_revisions_with_parents(), | "revision": get_revisions_with_parents(), | ||||
"directory": get_directories_with_nested_path(), | "directory": get_directories_with_nested_path() | ||||
+ get_directories_with_special_name_entries(), | |||||
"origin_visit_status": get_visit_with_multiple_status(), | "origin_visit_status": get_visit_with_multiple_status(), | ||||
} | } | ||||
def populate_dummy_data(storage): | def populate_dummy_data(storage): | ||||
for object_type, objects in swh_model_data.TEST_OBJECTS.items(): | for object_type, objects in swh_model_data.TEST_OBJECTS.items(): | ||||
method = getattr(storage, object_type + "_add") | method = getattr(storage, object_type + "_add") | ||||
method(objects) | method(objects) | ||||
for object_type, objects in GRAPHQL_EXTRA_TEST_OBJECTS.items(): | for object_type, objects in GRAPHQL_EXTRA_TEST_OBJECTS.items(): | ||||
method = getattr(storage, object_type + "_add") | method = getattr(storage, object_type + "_add") | ||||
method(objects) | method(objects) |
s/speical/special/