Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-model
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
Renaud Boyer
swh-model
Commits
843d814b
Verified
Commit
843d814b
authored
8 years ago
by
Antoine R. Dumont
Browse files
Options
Downloads
Patches
Plain Diff
Add missing tests on new api
parent
1a2b969c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
swh/model/tests/test_git.py
+344
-0
344 additions, 0 deletions
swh/model/tests/test_git.py
with
344 additions
and
0 deletions
swh/model/tests/test_git.py
+
344
−
0
View file @
843d814b
...
...
@@ -243,3 +243,347 @@ class GitHashFromScratch(GitHashWalkArborescenceTree):
# should give us the same checksums as the second round
self
.
assertEquals
(
actual_hashes
,
expected_hashes
)
class
TestObjectsPerType
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
objects
=
{
b
'
/tmp/tmp7w3oi_j8
'
:
{
'
children
'
:
{
b
'
/tmp/tmp7w3oi_j8/sample-folder
'
},
'
checksums
'
:
{
'
type
'
:
git
.
GitType
.
TREE
,
'
name
'
:
b
'
tmp7w3oi_j8
'
,
'
sha1_git
'
:
b
'
\xa7
A
\xfc
M
\x96\x8c
{
\x8e
<
\x94\xff\x86\xe7\x04\x80\xc5\xc7\xe5
r
\xa9
'
,
# noqa
'
path
'
:
b
'
/tmp/tmp7w3oi_j8
'
,
'
perms
'
:
git
.
GitPerm
.
TREE
},
},
b
'
/tmp/tmp7w3oi_j8/sample-folder
'
:
{
'
children
'
:
{
b
'
/tmp/tmp7w3oi_j8/sample-folder/empty-folder
'
,
b
'
/tmp/tmp7w3oi_j8/sample-folder/link-to-binary
'
,
b
'
/tmp/tmp7w3oi_j8/sample-folder/link-to-another-quote
'
,
b
'
/tmp/tmp7w3oi_j8/sample-folder/link-to-foo
'
,
b
'
/tmp/tmp7w3oi_j8/sample-folder/some-binary
'
,
b
'
/tmp/tmp7w3oi_j8/sample-folder/bar
'
,
b
'
/tmp/tmp7w3oi_j8/sample-folder/foo
'
,
},
'
checksums
'
:
{
'
type
'
:
git
.
GitType
.
TREE
,
'
name
'
:
b
'
sample-folder
'
,
'
sha1_git
'
:
b
'
\xe8\xb0\xf1
Fj
\xf8
`
\x8c\x8a
?
\xb9\x87\x9d\xb1
r
\xb8\x87\xe8\x07
Y
'
,
# noqa
'
path
'
:
b
'
/tmp/tmp7w3oi_j8/sample-folder
'
,
'
perms
'
:
git
.
GitPerm
.
TREE
}
},
b
'
/tmp/tmp7w3oi_j8/sample-folder/empty-folder
'
:
{
'
children
'
:
{},
'
checksums
'
:
{
'
type
'
:
git
.
GitType
.
TREE
,
'
name
'
:
b
'
empty-folder
'
,
'
sha1_git
'
:
b
'
K
\x82
]
\xc6
B
\xcb
n
\xb9\xa0
`
\xe5
K
\xf8\xd6\x92\x88\xfb\xee
I
\x04
'
,
# noqa
'
path
'
:
b
'
/tmp/tmp7w3oi_j8/sample-folder/empty-folder
'
,
'
perms
'
:
git
.
GitPerm
.
TREE
}
},
b
'
/tmp/tmp7w3oi_j8/sample-folder/link-to-binary
'
:
{
'
checksums
'
:
{
'
name
'
:
b
'
link-to-binary
'
,
'
sha1
'
:
b
'
\xd0
$
\x87\x14\x94\x8b
:H
\xa2
T8#*o
\x99\xf0
1
\x8f
Y
\xf1
'
,
# noqa
'
data
'
:
b
'
some-binary
'
,
'
sha1_git
'
:
b
'
\xe8
kE
\xe5
8
\xd9\xb6\x88\x8c\x96\x9c\x89\xfb\xd2
*
\x85\xaa\x0e\x03
f
'
,
# noqa
'
path
'
:
b
'
/tmp/tmp7w3oi_j8/sample-folder/link-to-binary
'
,
'
sha256
'
:
b
'
\x14\x12
n
\x97\xd8
?}&
\x1c
Zh
\x89\xce\xe7
6
\x19
w
\x0f\xf0\x9e
@
\xc5
I
\x86\x85\xab\xa7
E
\xbe\x88
.
\xff
'
,
# noqa
'
perms
'
:
git
.
GitPerm
.
LINK
,
'
type
'
:
git
.
GitType
.
BLOB
,
'
length
'
:
11
}
},
b
'
/tmp/tmp7w3oi_j8/sample-folder/link-to-another-quote
'
:
{
'
checksums
'
:
{
'
name
'
:
b
'
link-to-another-quote
'
,
'
sha1
'
:
b
'
\xcb\xee\xd1
^yY
\x9c\x90\xde
s
\x83\xf4
\xfe\xd7\xac\xb4\x8e\xa1
q
'
,
# noqa
'
data
'
:
b
'
bar/barfoo/another-quote.org
'
,
'
sha1_git
'
:
b
'
}
\\\x08\x11\x1e
!
\xc8\xa9\xf7\x15
@
\x93\x99\x98
U
\x16\x83
7_
\xad
'
,
# noqa
'
path
'
:
b
'
/tmp/tmp7w3oi_j8/sample-folder/link-to-another-quote
'
,
# noqa
'
sha256
'
:
b
'
\xe6\xe1
}
\x07\x93\xaa
u
\n\x04
@
\xeb\x9a\xd5\xb8\x0b
%
\x80
vc~
\xf0\xfb
h
\xf3\xac
.Y
\xe4\xb9\xac
;
\xa6
'
,
# noqa
'
perms
'
:
git
.
GitPerm
.
LINK
,
'
type
'
:
git
.
GitType
.
BLOB
,
'
length
'
:
28
}
},
b
'
/tmp/tmp7w3oi_j8/sample-folder/link-to-foo
'
:
{
'
checksums
'
:
{
'
name
'
:
b
'
link-to-foo
'
,
'
sha1
'
:
b
'
\x0b\xee\xc7\xb5\xea
?
\x0f\xdb\xc9
]
\r\xd4\x7f
<[
\xc2
u
\xda\x8a
3
'
,
# noqa
'
data
'
:
b
'
foo
'
,
'
sha1_git
'
:
b
'
\x19\x10
(
\x15
f=#
\xf8\xb7
ZG
\xe7\xa0\x19
e
\xdc\xdc\x96
F
\x8c
'
,
# noqa
'
path
'
:
b
'
/tmp/tmp7w3oi_j8/sample-folder/link-to-foo
'
,
'
sha256
'
:
b
'
,
\xb4
kh
\xff\xc6\x8f\xf9\x9b
E<
\x1d
0A4
\x13
B-pd
\x83\xbf\xa0\xf9\x8a
^
\x88
bf
\xe7\xae
'
,
# noqa
'
perms
'
:
git
.
GitPerm
.
LINK
,
'
type
'
:
git
.
GitType
.
BLOB
,
'
length
'
:
3
}
},
b
'
/tmp/tmp7w3oi_j8/sample-folder/some-binary
'
:
{
'
checksums
'
:
{
'
name
'
:
b
'
some-binary
'
,
'
sha1
'
:
b
'
\x0b\xbc\x12\xd7\xf4\xa2\xa1
[
\x14
=
\xa8
F
\x17\xd9\\\xb2
#
\xc9\xb2
<
'
,
# noqa
'
sha1_git
'
:
b
'
hv
\x95
y
\xc3\xea\xad\xbe
USy
\xb9\xc3
S
\x8e
f(
\xba\xe1\xeb
'
,
# noqa
'
path
'
:
b
'
/tmp/tmp7w3oi_j8/sample-folder/some-binary
'
,
'
sha256
'
:
b
'
\xba\xc6
P
\xd3
Jv8
\xbb\n\xeb
SBdm$
\xe3\xb9\xad
kD
\xc9\xb3\x83
b
\x1f\xaa
H+
\x99\n
6}
'
,
# noqa
'
perms
'
:
git
.
GitPerm
.
EXEC
,
'
type
'
:
git
.
GitType
.
BLOB
,
'
length
'
:
5
}
},
b
'
/tmp/tmp7w3oi_j8/sample-folder/bar
'
:
{
'
children
'
:
{
b
'
/tmp/tmp7w3oi_j8/sample-folder/bar/barfoo
'
},
'
checksums
'
:
{
'
type
'
:
git
.
GitType
.
TREE
,
'
name
'
:
b
'
bar
'
,
'
sha1_git
'
:
b
'
<
\x1f
W
\x83\x94\xf4
b?t
\xa0\xba\x7f\xe7
ar
\x9f
Y
\xfc
n
\xc4
'
,
# noqa
'
path
'
:
b
'
/tmp/tmp7w3oi_j8/sample-folder/bar
'
,
'
perms
'
:
git
.
GitPerm
.
TREE
},
},
b
'
/tmp/tmp7w3oi_j8/sample-folder/bar/barfoo
'
:
{
'
children
'
:
{
b
'
/tmp/tmp7w3oi_j8/sample-folder/bar/barfoo/another-quote.org
'
},
# noqa
'
checksums
'
:
{
'
type
'
:
git
.
GitType
.
TREE
,
'
name
'
:
b
'
barfoo
'
,
'
sha1_git
'
:
b
'
\xc3\x02\x0f
k
\xf1
5
\xa3\x8c
m
\xf3\xaf\xeb
_
\xb3\x82
2
\xc5\xe0
p
\x87
'
,
# noqa
'
path
'
:
b
'
/tmp/tmp7w3oi_j8/sample-folder/bar/barfoo
'
,
# noqa
'
perms
'
:
git
.
GitPerm
.
TREE
},
},
b
'
/tmp/tmp7w3oi_j8/sample-folder/bar/barfoo/another-quote.org
'
:
{
'
checksums
'
:
{
'
name
'
:
b
'
another-quote.org
'
,
'
sha1
'
:
b
'
\x90\xa6\x13\x8b\xa5\x99\x15
&
\x1e\x17\x99
H8j
\xa1\xcc
*
\xa9
"
\n
'
,
# noqa
'
sha1_git
'
:
b
'
\x13
6
\x93\xb1
%
\xba\xd2\xb4\xac
1
\x85
5
\xb8
I
\x01\xeb\xb1\xf6\xb6
8
'
,
# noqa
'
path
'
:
b
'
/tmp/tmp7w3oi_j8/sample-folder/bar/barfoo/another-quote.org
'
,
# noqa
'
sha256
'
:
b
'
=
\xb5\xae\x16\x80
U
\xbc\xd9
:M
\x08
(]
\xc9\x9f\xfe\xe2\x88
3
\x03\xb2
?
\xac
^
\xab\x85\x02
s
\xa8\xea
UF
'
,
# noqa
'
perms
'
:
git
.
GitPerm
.
BLOB
,
'
type
'
:
git
.
GitType
.
BLOB
,
'
length
'
:
72
}
},
b
'
/tmp/tmp7w3oi_j8/sample-folder/foo
'
:
{
'
children
'
:
{
b
'
/tmp/tmp7w3oi_j8/sample-folder/foo/barfoo
'
,
b
'
/tmp/tmp7w3oi_j8/sample-folder/foo/rel-link-to-barfoo
'
,
b
'
/tmp/tmp7w3oi_j8/sample-folder/foo/quotes.md
'
,
},
'
checksums
'
:
{
'
type
'
:
git
.
GitType
.
TREE
,
'
name
'
:
b
'
foo
'
,
'
sha1_git
'
:
b
'
+A
\xc4\x0f\r\x1f\xbf\xfc\xba\x12
I}
\xb7\x1f\xba\x83\xfc\xca\x96\xe5
'
,
# noqa
'
path
'
:
b
'
/tmp/tmp7w3oi_j8/sample-folder/foo
'
,
'
perms
'
:
git
.
GitPerm
.
TREE
}
},
b
'
/tmp/tmp7w3oi_j8/sample-folder/foo/barfoo
'
:
{
'
checksums
'
:
{
'
name
'
:
b
'
barfoo
'
,
'
sha1
'
:
b
'
\x90
W
\xee
m
\x01
bPn
\x01\xc4\xd9\xd5
E
\x9a
z
\xdd\x1f\xed\xac
7
'
,
# noqa
'
data
'
:
b
'
bar/barfoo
'
,
'
sha1_git
'
:
b
'
\x81\x85\xdf\xb2\xc0\xc2\xc5\x97\xd1
ou
\xa8\xa0\xc3
vhV|=~
'
,
# noqa
'
path
'
:
b
'
/tmp/tmp7w3oi_j8/sample-folder/foo/barfoo
'
,
# noqa
'
sha256
'
:
b
'
)
\xad
?W%2
\x1b\x94\x03
2
\xc7\x8e
@6
\x01\xaf\xff
a
\xda\xea\x85\xe9\xc8\x0b
Jpc
\xb6\x88
~
\xad
h
'
,
# noqa
'
perms
'
:
git
.
GitPerm
.
LINK
,
'
type
'
:
git
.
GitType
.
BLOB
,
'
length
'
:
10
}
},
b
'
/tmp/tmp7w3oi_j8/sample-folder/foo/rel-link-to-barfoo
'
:
{
'
checksums
'
:
{
'
name
'
:
b
'
rel-link-to-barfoo
'
,
'
sha1
'
:
b
'
\xdc
Q
"
\x1d
0
\x8f
:
\xeb\'
T
\xdb
H9
\x1b\x85
h|(i
\xf4
'
,
# noqa
'
data
'
:
b
'
../bar/barfoo
'
,
'
sha1_git
'
:
b
'
\xac\xac
2m
\xdd
c
\xb0\xbc
p
\x84\x06
Y
\xd4\xac
Ca
\x94\x84\xe6\x9f
'
,
# noqa
'
path
'
:
b
'
/tmp/tmp7w3oi_j8/sample-folder/foo/rel-link-to-barfoo
'
,
# noqa
'
sha256
'
:
b
'
\x80\x07\xd2\r\xb2\xaf
@C_B
\xdd\xef
K
\x8a\xd7
k
\x80\xad\xbe\xc2
k$
\x9f\xdf\x04
s5?
\x8d\x99\xdf\x08
'
,
# noqa
'
perms
'
:
git
.
GitPerm
.
LINK
,
'
type
'
:
git
.
GitType
.
BLOB
,
'
length
'
:
13
}
},
b
'
/tmp/tmp7w3oi_j8/sample-folder/foo/quotes.md
'
:
{
'
checksums
'
:
{
'
name
'
:
b
'
quotes.md
'
,
'
sha1
'
:
b
'
\x1b\xf0\xbb
r
\x1a\xc9
,x18
\xa1\x9b\x13\xc0\xeb
=t
\x1c\xbf\xad\xeb\xfc
'
,
# noqa
'
sha1_git
'
:
b
'
|LW
\xba\x9f\xf4\x96\xad\x17\x9b\x8f
e
\xb1\xd2\x86\xed\xbd\xa3
L
\x9a
'
,
# noqa
'
path
'
:
b
'
/tmp/tmp7w3oi_j8/sample-folder/foo/quotes.md
'
,
# noqa
'
sha256
'
:
b
'
\xca\xca\x94
*
\xed\xa7\xb3\x08\x85\x9e\xb5
o
\x90\x9e\xc9
m
\x07\xa4\x99
I
\x16\x90\xc4
S
\xf7
;
\x98\x00\xa9
;
\x16
Y
'
,
# noqa
'
perms
'
:
git
.
GitPerm
.
BLOB
,
'
type
'
:
git
.
GitType
.
BLOB
,
'
length
'
:
66
}
},
}
@istest
def
objects_per_type_blob
(
self
):
# given
expected_blobs
=
[
{
'
name
'
:
b
'
another-quote.org
'
,
'
sha1
'
:
b
'
\x90\xa6\x13\x8b\xa5\x99\x15
&
\x1e\x17\x99
H8j
\xa1\xcc
*
\xa9
"
\n
'
,
# noqa
'
sha1_git
'
:
b
'
\x13
6
\x93\xb1
%
\xba\xd2\xb4\xac
1
\x85
5
\xb8
I
\x01\xeb\xb1\xf6\xb6
8
'
,
# noqa
'
path
'
:
b
'
/tmp/tmp7w3oi_j8/sample-folder/bar/barfoo/another-quote.org
'
,
# noqa
'
sha256
'
:
b
'
=
\xb5\xae\x16\x80
U
\xbc\xd9
:M
\x08
(]
\xc9\x9f\xfe\xe2\x88
3
\x03\xb2
?
\xac
^
\xab\x85\x02
s
\xa8\xea
UF
'
,
# noqa
'
perms
'
:
git
.
GitPerm
.
BLOB
,
'
type
'
:
git
.
GitType
.
BLOB
,
'
length
'
:
72
},
{
'
name
'
:
b
'
link-to-binary
'
,
'
sha1
'
:
b
'
\xd0
$
\x87\x14\x94\x8b
:H
\xa2
T8#*o
\x99\xf0
1
\x8f
Y
\xf1
'
,
'
data
'
:
b
'
some-binary
'
,
'
sha1_git
'
:
b
'
\xe8
kE
\xe5
8
\xd9\xb6\x88\x8c\x96\x9c\x89\xfb\xd2
*
\x85\xaa\x0e\x03
f
'
,
# noqa
'
path
'
:
b
'
/tmp/tmp7w3oi_j8/sample-folder/link-to-binary
'
,
'
sha256
'
:
b
'
\x14\x12
n
\x97\xd8
?}&
\x1c
Zh
\x89\xce\xe7
6
\x19
w
\x0f\xf0\x9e
@
\xc5
I
\x86\x85\xab\xa7
E
\xbe\x88
.
\xff
'
,
# noqa
'
perms
'
:
git
.
GitPerm
.
LINK
,
'
type
'
:
git
.
GitType
.
BLOB
,
'
length
'
:
11
},
{
'
name
'
:
b
'
link-to-another-quote
'
,
'
sha1
'
:
b
'
\xcb\xee\xd1
^yY
\x9c\x90\xde
s
\x83\xf4
\xfe\xd7\xac\xb4\x8e\xa1
q
'
,
# noqa
'
data
'
:
b
'
bar/barfoo/another-quote.org
'
,
'
sha1_git
'
:
b
'
}
\\\x08\x11\x1e
!
\xc8\xa9\xf7\x15
@
\x93\x99\x98
U
\x16\x83
7_
\xad
'
,
# noqa
'
path
'
:
b
'
/tmp/tmp7w3oi_j8/sample-folder/link-to-another-quote
'
,
# noqa
'
sha256
'
:
b
'
\xe6\xe1
}
\x07\x93\xaa
u
\n\x04
@
\xeb\x9a\xd5\xb8\x0b
%
\x80
vc~
\xf0\xfb
h
\xf3\xac
.Y
\xe4\xb9\xac
;
\xa6
'
,
# noqa
'
perms
'
:
git
.
GitPerm
.
LINK
,
'
type
'
:
git
.
GitType
.
BLOB
,
'
length
'
:
28
},
{
'
name
'
:
b
'
link-to-foo
'
,
'
sha1
'
:
b
'
\x0b\xee\xc7\xb5\xea
?
\x0f\xdb\xc9
]
\r\xd4\x7f
<[
\xc2
u
\xda\x8a
3
'
,
# noqa
'
data
'
:
b
'
foo
'
,
'
sha1_git
'
:
b
'
\x19\x10
(
\x15
f=#
\xf8\xb7
ZG
\xe7\xa0\x19
e
\xdc\xdc\x96
F
\x8c
'
,
# noqa
'
path
'
:
b
'
/tmp/tmp7w3oi_j8/sample-folder/link-to-foo
'
,
'
sha256
'
:
b
'
\xb4
kh
\xff\xc6\x8f\xf9\x9b
E<
\x1d
0A4
\x13
B-pd
\x83\xbf\xa0\xf9\x8a
^
\x88
bf
\xe7\xae
'
,
# noqa
'
perms
'
:
git
.
GitPerm
.
LINK
,
'
type
'
:
git
.
GitType
.
BLOB
,
'
length
'
:
3
},
{
'
name
'
:
b
'
some-binary
'
,
'
sha1
'
:
b
'
\x0b\xbc\x12\xd7\xf4\xa2\xa1
[
\x14
=
\xa8
F
\x17\xd9\\\xb2
#
\xc9\xb2
<
'
,
# noqa
'
sha1_git
'
:
b
'
hv
\x95
y
\xc3\xea\xad\xbe
USy
\xb9\xc3
S
\x8e
f(
\xba\xe1\xeb
'
,
# noqa
'
path
'
:
b
'
/tmp/tmp7w3oi_j8/sample-folder/some-binary
'
,
'
sha256
'
:
b
'
\xba\xc6
P
\xd3
Jv8
\xbb\n\xeb
SBdm$
\xe3\xb9\xad
kD
\xc9\xb3\x83
b
\x1f\xaa
H+
\x99\n
6}
'
,
# noqa
'
perms
'
:
git
.
GitPerm
.
EXEC
,
'
type
'
:
git
.
GitType
.
BLOB
,
'
length
'
:
5
},
{
'
name
'
:
b
'
barfoo
'
,
'
sha1
'
:
b
'
\x90
W
\xee
m
\x01
bPn
\x01\xc4\xd9\xd5
E
\x9a
z
\xdd\x1f\xed\xac
7
'
,
# noqa
'
data
'
:
b
'
bar/barfoo
'
,
'
sha1_git
'
:
b
'
\x81\x85\xdf\xb2\xc0\xc2\xc5\x97\xd1
ou
\xa8\xa0\xc3
vhV|=~
'
,
# noqa
'
path
'
:
b
'
/tmp/tmp7w3oi_j8/sample-folder/foo/barfoo
'
,
'
sha256
'
:
b
'
)
\xad
?W%2
\x1b\x94\x03
2
\xc7\x8e
@6
\x01\xaf\xff
a
\xda\xea\x85\xe9\xc8\x0b
Jpc
\xb6\x88
~
\xad
h
'
,
# noqa
'
perms
'
:
git
.
GitPerm
.
LINK
,
'
type
'
:
git
.
GitType
.
BLOB
,
'
length
'
:
10
},
{
'
name
'
:
b
'
rel-link-to-barfoo
'
,
'
sha1
'
:
b
'
\xdc
Q
"
\x1d
0
\x8f
:
\xeb\'
T
\xdb
H9
\x1b\x85
h|(i
\xf4
'
,
'
data
'
:
b
'
../bar/barfoo
'
,
'
sha1_git
'
:
b
'
\xac\xac
2m
\xdd
c
\xb0\xbc
p
\x84\x06
Y
\xd4\xac
Ca
\x94\x84\xe6\x9f
'
,
# noqa
'
path
'
:
b
'
/tmp/tmp7w3oi_j8/sample-folder/foo/rel-link-to-barfoo
'
,
# noqa
'
sha256
'
:
b
'
\x80\x07\xd2\r\xb2\xaf
@C_B
\xdd\xef
K
\x8a\xd7
k
\x80\xad\xbe\xc2
k$
\x9f\xdf\x04
s5?
\x8d\x99\xdf\x08
'
,
# noqa
'
perms
'
:
git
.
GitPerm
.
LINK
,
'
type
'
:
git
.
GitType
.
BLOB
,
'
length
'
:
13
},
{
'
name
'
:
b
'
quotes.md
'
,
'
sha1
'
:
b
'
\x1b\xf0\xbb
r
\x1a\xc9
,x18
\xa1\x9b\x13\xc0\xeb
=t
\x1c\xbf\xad\xeb\xfc
'
,
# noqa
'
sha1_git
'
:
b
'
|LW
\xba\x9f\xf4\x96\xad\x17\x9b\x8f
e
\xb1\xd2\x86\xed\xbd\xa3
L
\x9a
'
,
# noqa
'
path
'
:
b
'
/tmp/tmp7w3oi_j8/sample-folder/foo/quotes.md
'
,
'
sha256
'
:
b
'
\xca\xca\x94
*
\xed\xa7\xb3\x08\x85\x9e\xb5
o
\x90\x9e\xc9
m
\x07\xa4\x99
I
\x16\x90\xc4
S
\xf7
;
\x98\x00\xa9
;
\x16
Y
'
,
# noqa
'
perms
'
:
git
.
GitPerm
.
BLOB
,
'
type
'
:
git
.
GitType
.
BLOB
,
'
length
'
:
66
},
]
expected_sha1_blobs
=
set
(
((
c
[
'
sha1_git
'
],
git
.
GitType
.
BLOB
)
for
c
in
expected_blobs
))
# when
actual_sha1_blobs
=
set
(
((
c
[
'
sha1_git
'
],
c
[
'
type
'
])
for
c
in
git
.
objects_per_type
(
git
.
GitType
.
BLOB
,
self
.
objects
)))
# then
self
.
assertEqual
(
actual_sha1_blobs
,
expected_sha1_blobs
)
@istest
def
objects_per_type_tree
(
self
):
def
__children_hashes
(
path
,
objects
=
self
.
objects
):
return
set
((
c
[
'
sha1_git
'
]
for
c
in
git
.
children_hashes
(
objects
[
path
][
'
children
'
],
objects
)))
expected_trees
=
[
{
'
type
'
:
git
.
GitType
.
TREE
,
'
name
'
:
b
'
tmp7w3oi_j8
'
,
'
sha1_git
'
:
b
'
\xa7
A
\xfc
M
\x96\x8c
{
\x8e
<
\x94\xff\x86\xe7\x04\x80\xc5\xc7\xe5
r
\xa9
'
,
# noqa
'
path
'
:
b
'
/tmp/tmp7w3oi_j8
'
,
'
perms
'
:
git
.
GitPerm
.
TREE
,
# we only add children's sha1_git here, in reality,
# it's a full dict of hashes.
'
children
'
:
__children_hashes
(
b
'
/tmp/tmp7w3oi_j8
'
)
},
{
'
type
'
:
git
.
GitType
.
TREE
,
'
name
'
:
b
'
sample-folder
'
,
'
sha1_git
'
:
b
'
\xe8\xb0\xf1
Fj
\xf8
`
\x8c\x8a
?
\xb9\x87\x9d\xb1
r
\xb8\x87\xe8\x07
Y
'
,
# noqa
'
path
'
:
b
'
/tmp/tmp7w3oi_j8/sample-folder
'
,
'
perms
'
:
git
.
GitPerm
.
TREE
,
'
children
'
:
__children_hashes
(
b
'
/tmp/tmp7w3oi_j8/sample-folder
'
)
},
{
'
type
'
:
git
.
GitType
.
TREE
,
'
name
'
:
b
'
empty-folder
'
,
'
sha1_git
'
:
b
'
K
\x82
]
\xc6
B
\xcb
n
\xb9\xa0
`
\xe5
K
\xf8\xd6\x92\x88\xfb\xee
I
\x04
'
,
# noqa
'
path
'
:
b
'
/tmp/tmp7w3oi_j8/sample-folder/empty-folder
'
,
'
perms
'
:
git
.
GitPerm
.
TREE
,
'
children
'
:
__children_hashes
(
b
'
/tmp/tmp7w3oi_j8/sample-folder/empty-folder
'
)
},
{
'
type
'
:
git
.
GitType
.
TREE
,
'
name
'
:
b
'
bar
'
,
'
sha1_git
'
:
b
'
<
\x1f
W
\x83\x94\xf4
b?t
\xa0\xba\x7f\xe7
ar
\x9f
Y
\xfc
n
\xc4
'
,
# noqa
'
path
'
:
b
'
/tmp/tmp7w3oi_j8/sample-folder/bar
'
,
'
perms
'
:
git
.
GitPerm
.
TREE
,
'
children
'
:
__children_hashes
(
b
'
/tmp/tmp7w3oi_j8/sample-folder/bar
'
)
},
{
'
type
'
:
git
.
GitType
.
TREE
,
'
name
'
:
b
'
barfoo
'
,
'
sha1_git
'
:
b
'
\xc3\x02\x0f
k
\xf1
5
\xa3\x8c
m
\xf3\xaf\xeb
_
\xb3\x82
2
\xc5\xe0
p
\x87
'
,
# noqa
'
path
'
:
b
'
/tmp/tmp7w3oi_j8/sample-folder/bar/barfoo
'
,
'
perms
'
:
git
.
GitPerm
.
TREE
,
'
children
'
:
__children_hashes
(
b
'
/tmp/tmp7w3oi_j8/sample-folder/bar/barfoo
'
),
},
{
'
type
'
:
git
.
GitType
.
TREE
,
'
name
'
:
b
'
foo
'
,
'
sha1_git
'
:
b
'
+A
\xc4\x0f\r\x1f\xbf\xfc\xba\x12
I}
\xb7\x1f\xba\x83\xfc\xca\x96\xe5
'
,
# noqa
'
path
'
:
b
'
/tmp/tmp7w3oi_j8/sample-folder/foo
'
,
'
perms
'
:
git
.
GitPerm
.
TREE
,
'
children
'
:
__children_hashes
(
b
'
/tmp/tmp7w3oi_j8/sample-folder/foo
'
)
},
]
expected_sha1_trees
=
list
(
((
c
[
'
sha1_git
'
],
git
.
GitType
.
TREE
,
c
[
'
children
'
])
for
c
in
expected_trees
))
print
(
expected_sha1_trees
)
# when
actual_sha1_trees
=
list
(
((
c
[
'
sha1_git
'
],
c
[
'
type
'
],
__children_hashes
(
c
[
'
path
'
]))
for
c
in
git
.
objects_per_type
(
git
.
GitType
.
TREE
,
self
.
objects
)))
self
.
assertEquals
(
len
(
actual_sha1_trees
),
len
(
expected_sha1_trees
))
for
e
in
actual_sha1_trees
:
self
.
assertTrue
(
e
in
expected_sha1_trees
)
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