Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-web
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pierre-Yves David
swh-web
Commits
8e8df4bb
Verified
Commit
8e8df4bb
authored
7 years ago
by
Antoine R. Dumont
Browse files
Options
Downloads
Patches
Plain Diff
swh.web.api: Add snapshot conversion on origin_visit
Related T565
parent
11b2f550
Branches
wip/snapshot
Branches containing commit
Tags
v0.0.111
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
swh/web/common/converters.py
+1
-1
1 addition, 1 deletion
swh/web/common/converters.py
swh/web/tests/common/test_converters.py
+36
-0
36 additions, 0 deletions
swh/web/tests/common/test_converters.py
with
37 additions
and
1 deletion
swh/web/common/converters.py
+
1
−
1
View file @
8e8df4bb
...
...
@@ -305,7 +305,7 @@ def from_origin_visit(visit):
"""
ov
=
from_swh
(
visit
,
hashess
=
{
'
target
'
},
hashess
=
{
'
target
'
,
'
snapshot
'
},
bytess
=
{
'
branch
'
},
dates
=
{
'
date
'
},
empty_dict
=
{
'
metadata
'
})
...
...
This diff is collapsed.
Click to expand it.
swh/web/tests/common/test_converters.py
+
36
−
0
View file @
8e8df4bb
...
...
@@ -207,6 +207,42 @@ class ConvertersTestCase(unittest.TestCase):
# then
self
.
assertEqual
(
actual_origin
,
expected_origin
)
@istest
def
from_origin_visit
(
self
):
snap_hash
=
'
b5f0b7f716735ebffe38505c60145c4fd9da6ca3
'
for
snap
in
[
snap_hash
,
None
]:
# given
visit
=
{
'
date
'
:
{
'
timestamp
'
:
datetime
.
datetime
(
2015
,
1
,
1
,
22
,
0
,
0
,
tzinfo
=
datetime
.
timezone
.
utc
).
timestamp
(),
'
offset
'
:
0
,
'
negative_utc
'
:
False
,
},
'
origin
'
:
10
,
'
visit
'
:
100
,
'
metadata
'
:
None
,
'
status
'
:
'
full
'
,
'
snapshot
'
:
hashutil
.
hash_to_bytes
(
snap
)
if
snap
else
snap
,
}
expected_visit
=
{
'
date
'
:
'
2015-01-01T22:00:00+00:00
'
,
'
origin
'
:
10
,
'
visit
'
:
100
,
'
metadata
'
:
{},
'
status
'
:
'
full
'
,
'
snapshot
'
:
snap_hash
if
snap
else
snap
}
# when
actual_visit
=
converters
.
from_origin_visit
(
visit
)
# then
self
.
assertEqual
(
actual_visit
,
expected_visit
)
@istest
def
from_release
(
self
):
release_input
=
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment