Skip to content
Snippets Groups Projects
Commit fcfbd4de authored by vlorentz's avatar vlorentz
Browse files

Make OriginVisit.snapshot optional.

It already is in practice.
parent 73053a68
No related branches found
Tags v0.0.56
No related merge requests found
......@@ -26,6 +26,10 @@ pgsql_alphabet = characters(
blacklist_characters=['\u0000']) # postgresql does not like these
def optional(strategy):
return one_of(none(), strategy)
def pgsql_text():
return text(alphabet=pgsql_alphabet)
......@@ -81,7 +85,8 @@ def origin_visits():
visit=integers(0, 1000),
origin=urls(),
status=sampled_from(['ongoing', 'full', 'partial']),
type=pgsql_text())
type=pgsql_text(),
snapshot=optional(sha1_git()))
@composite
......@@ -148,9 +153,6 @@ def present_contents(draw):
@composite
def skipped_contents(draw):
def optional(strategy):
return one_of(none(), strategy)
return draw(builds(
SkippedContent,
length=integers(min_value=-1, max_value=2**63-1),
......
......@@ -149,7 +149,7 @@ class OriginVisit(BaseModel):
type=str,
validator=attr.validators.in_(['ongoing', 'full', 'partial']))
type = attr.ib(type=str)
snapshot = attr.ib(type=Sha1Git)
snapshot = attr.ib(type=Optional[Sha1Git])
metadata = attr.ib(type=Optional[Dict[str, object]],
default=None)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment