Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
re6stnet
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Milestones
Merge Requests
4
Merge Requests
4
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
re6stnet
Commits
47b8d3c0
Commit
47b8d3c0
authored
Jun 18, 2024
by
Tom Niget
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
py2to3: fix various python2 test and types breakings
parent
52d6f7a5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
8 deletions
+8
-8
re6st/registry.py
re6st/registry.py
+1
-1
re6st/tests/test_end2end/test_registry_client.py
re6st/tests/test_end2end/test_registry_client.py
+5
-4
re6st/tests/test_network/test_net.py
re6st/tests/test_network/test_net.py
+1
-2
re6st/tests/test_unit/test_registry.py
re6st/tests/test_unit/test_registry.py
+1
-1
No files found.
re6st/registry.py
View file @
47b8d3c0
...
@@ -816,7 +816,7 @@ class RegistryClient(object):
...
@@ -816,7 +816,7 @@ class RegistryClient(object):
kw
=
getcallargs
(
*
args
,
**
kw
)
kw
=
getcallargs
(
*
args
,
**
kw
)
query
=
'/'
+
name
query
=
'/'
+
name
if
kw
:
if
kw
:
if
any
(
type
(
v
)
is
not
str
for
v
in
kw
.
values
()):
if
any
(
not
isinstance
(
v
,
(
str
,
bytes
))
for
v
in
kw
.
values
()):
raise
TypeError
(
kw
)
raise
TypeError
(
kw
)
query
+=
'?'
+
urlencode
(
kw
)
query
+=
'?'
+
urlencode
(
kw
)
url
=
self
.
_path
+
query
url
=
self
.
_path
+
query
...
...
re6st/tests/test_end2end/test_registry_client.py
View file @
47b8d3c0
...
@@ -70,7 +70,7 @@ class TestRegistryClientInteract(unittest.TestCase):
...
@@ -70,7 +70,7 @@ class TestRegistryClientInteract(unittest.TestCase):
self
.
fail
(
"Request token failed, no token in database"
)
self
.
fail
(
"Request token failed, no token in database"
)
# token: tuple[unicode,]
# token: tuple[unicode,]
token
=
str
(
token
[
0
])
token
=
str
(
token
[
0
])
self
.
assertEqual
(
client
.
isToken
(
token
),
"1"
)
self
.
assertEqual
(
client
.
isToken
(
token
)
.
decode
()
,
"1"
)
# request ca
# request ca
ca
=
client
.
getCa
()
ca
=
client
.
getCa
()
...
@@ -78,7 +78,7 @@ class TestRegistryClientInteract(unittest.TestCase):
...
@@ -78,7 +78,7 @@ class TestRegistryClientInteract(unittest.TestCase):
# request a cert and get cn
# request a cert and get cn
key
,
csr
=
tools
.
generate_csr
()
key
,
csr
=
tools
.
generate_csr
()
cert
=
client
.
requestCertificate
(
token
,
csr
)
cert
=
client
.
requestCertificate
(
token
,
csr
)
self
.
assertEqual
(
client
.
isToken
(
token
),
''
,
"token should be deleted"
)
self
.
assertEqual
(
client
.
isToken
(
token
)
.
decode
()
,
''
,
"token should be deleted"
)
# creat x509.cert object
# creat x509.cert object
def
write_to_temp
(
text
):
def
write_to_temp
(
text
):
...
@@ -97,18 +97,19 @@ class TestRegistryClientInteract(unittest.TestCase):
...
@@ -97,18 +97,19 @@ class TestRegistryClientInteract(unittest.TestCase):
# verfiy cn and prefix
# verfiy cn and prefix
prefix
=
client
.
cert
.
prefix
prefix
=
client
.
cert
.
prefix
cn
=
client
.
getNodePrefix
(
email
)
cn
=
client
.
getNodePrefix
(
email
)
.
decode
()
self
.
assertEqual
(
tools
.
prefix2cn
(
prefix
),
cn
)
self
.
assertEqual
(
tools
.
prefix2cn
(
prefix
),
cn
)
# simulate the process in cache
# simulate the process in cache
# just prove works
# just prove works
net_config
=
client
.
getNetworkConfig
(
prefix
)
net_config
=
client
.
getNetworkConfig
(
prefix
)
self
.
assertIsNotNone
(
net_config
)
net_config
=
json
.
loads
(
zlib
.
decompress
(
net_config
))
net_config
=
json
.
loads
(
zlib
.
decompress
(
net_config
))
self
.
assertEqual
(
net_config
[
u'max_clients'
],
self
.
max_clients
)
self
.
assertEqual
(
net_config
[
u'max_clients'
],
self
.
max_clients
)
# no re6stnet, empty result
# no re6stnet, empty result
bootpeer
=
client
.
getBootstrapPeer
(
prefix
)
bootpeer
=
client
.
getBootstrapPeer
(
prefix
)
self
.
assertEqual
(
bootpeer
,
""
)
self
.
assertEqual
(
bootpeer
.
decode
()
,
""
)
# server should not die
# server should not die
self
.
assertIsNone
(
self
.
server
.
proc
.
poll
())
self
.
assertIsNone
(
self
.
server
.
proc
.
poll
())
...
...
re6st/tests/test_network/test_net.py
View file @
47b8d3c0
...
@@ -8,8 +8,7 @@ import logging
...
@@ -8,8 +8,7 @@ import logging
import
random
import
random
from
pathlib
import
Path
from
pathlib
import
Path
import
network_build
from
.
import
network_build
,
re6st_wrap
import
re6st_wrap
PING_PATH
=
str
(
Path
(
__file__
).
parent
.
resolve
()
/
"ping.py"
)
PING_PATH
=
str
(
Path
(
__file__
).
parent
.
resolve
()
/
"ping.py"
)
...
...
re6st/tests/test_unit/test_registry.py
View file @
47b8d3c0
...
@@ -177,7 +177,7 @@ class TestRegistryServer(unittest.TestCase):
...
@@ -177,7 +177,7 @@ class TestRegistryServer(unittest.TestCase):
request
.
send_header
.
assert_any_call
(
"Content-Length"
,
str
(
len
(
result
)))
request
.
send_header
.
assert_any_call
(
"Content-Length"
,
str
(
len
(
result
)))
request
.
send_header
.
assert_any_call
(
request
.
send_header
.
assert_any_call
(
registry
.
HMAC_HEADER
,
registry
.
HMAC_HEADER
,
base64
.
b64encode
(
hmac
.
HMAC
(
key
,
result
,
hashlib
.
sha1
).
digest
()))
base64
.
b64encode
(
hmac
.
HMAC
(
key
,
result
,
hashlib
.
sha1
).
digest
())
.
decode
(
"ascii"
)
)
request
.
wfile
.
write
.
assert_called_once_with
(
result
)
request
.
wfile
.
write
.
assert_called_once_with
(
result
)
# remove the create session \n
# remove the create session \n
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment