Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
beem
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
Container Registry
Model registry
Operate
Environments
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
hive
beem
Commits
eddab42a
Commit
eddab42a
authored
6 years ago
by
Holger Nahrstaedt
Browse files
Options
Downloads
Patches
Plain Diff
Try to fix unit tests for python 2.7
parent
b4f8cfb4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
beem/steemconnect.py
+2
-3
2 additions, 3 deletions
beem/steemconnect.py
tests/beem/test_steemconnect.py
+9
-2
9 additions, 2 deletions
tests/beem/test_steemconnect.py
with
11 additions
and
5 deletions
beem/steemconnect.py
+
2
−
3
View file @
eddab42a
...
@@ -15,7 +15,6 @@ from .storage import configStorage as config
...
@@ -15,7 +15,6 @@ from .storage import configStorage as config
from
six
import
PY2
from
six
import
PY2
from
beem.instance
import
shared_steem_instance
from
beem.instance
import
shared_steem_instance
from
beem.amount
import
Amount
from
beem.amount
import
Amount
from
collections
import
OrderedDict
class
SteemConnect
(
object
):
class
SteemConnect
(
object
):
...
@@ -109,7 +108,7 @@ class SteemConnect(object):
...
@@ -109,7 +108,7 @@ class SteemConnect(object):
if
PY2
:
if
PY2
:
return
urljoin
(
return
urljoin
(
self
.
oauth_base_url
,
self
.
oauth_base_url
,
"
authorize?
"
+
urlencode
(
params
).
replace
(
"
+
"
,
"
%20
"
))
"
authorize?
"
+
urlencode
(
params
).
replace
(
'
%2C
'
,
'
,
'
))
else
:
else
:
return
urljoin
(
return
urljoin
(
self
.
oauth_base_url
,
self
.
oauth_base_url
,
...
@@ -250,7 +249,7 @@ class SteemConnect(object):
...
@@ -250,7 +249,7 @@ class SteemConnect(object):
operations
=
tx
[
"
operations
"
]
operations
=
tx
[
"
operations
"
]
for
op
in
operations
:
for
op
in
operations
:
operation
=
op
[
0
]
operation
=
op
[
0
]
params
=
OrderedDict
(
op
[
1
]
)
params
=
op
[
1
]
for
key
in
params
:
for
key
in
params
:
value
=
params
[
key
]
value
=
params
[
key
]
if
isinstance
(
value
,
list
)
and
len
(
value
)
==
3
:
if
isinstance
(
value
,
list
)
and
len
(
value
)
==
3
:
...
...
This diff is collapsed.
Click to expand it.
tests/beem/test_steemconnect.py
+
9
−
2
View file @
eddab42a
...
@@ -10,6 +10,7 @@ import unittest
...
@@ -10,6 +10,7 @@ import unittest
from
parameterized
import
parameterized
from
parameterized
import
parameterized
import
random
import
random
import
json
import
json
from
six
import
PY2
from
pprint
import
pprint
from
pprint
import
pprint
from
beem
import
Steem
,
exceptions
from
beem
import
Steem
,
exceptions
from
beem.amount
import
Amount
from
beem.amount
import
Amount
...
@@ -64,7 +65,10 @@ class Testcases(unittest.TestCase):
...
@@ -64,7 +65,10 @@ class Testcases(unittest.TestCase):
"
test1
"
,
1.000
,
"
STEEM
"
,
memo
=
"
test
"
)
"
test1
"
,
1.000
,
"
STEEM
"
,
memo
=
"
test
"
)
sc2
=
SteemConnect
(
steem_instance
=
bts
)
sc2
=
SteemConnect
(
steem_instance
=
bts
)
url
=
sc2
.
url_from_tx
(
tx
)
url
=
sc2
.
url_from_tx
(
tx
)
self
.
assertEqual
(
url
,
'
https://v2.steemconnect.com/sign/transfer?from=test&to=test1&amount=1.000+STEEM&memo=test
'
)
if
PY2
:
self
.
assertEqual
(
url
,
'
https://v2.steemconnect.com/sign/transfer?from=test&memo=test&to=test1&amount=1.000+STEEM
'
)
else
:
self
.
assertEqual
(
url
,
'
https://v2.steemconnect.com/sign/transfer?from=test&to=test1&amount=1.000+STEEM&memo=test
'
)
@parameterized.expand
([
@parameterized.expand
([
(
"
non_appbase
"
),
(
"
non_appbase
"
),
...
@@ -77,4 +81,7 @@ class Testcases(unittest.TestCase):
...
@@ -77,4 +81,7 @@ class Testcases(unittest.TestCase):
bts
=
self
.
appbase
bts
=
self
.
appbase
sc2
=
SteemConnect
(
steem_instance
=
bts
)
sc2
=
SteemConnect
(
steem_instance
=
bts
)
url
=
sc2
.
get_login_url
(
"
localhost
"
,
scope
=
"
login,vote
"
)
url
=
sc2
.
get_login_url
(
"
localhost
"
,
scope
=
"
login,vote
"
)
self
.
assertEqual
(
url
,
'
https://v2.steemconnect.com/oauth2/authorize?client_id=None&redirect_uri=localhost&scope=login,vote
'
)
if
PY2
:
self
.
assertEqual
(
url
,
'
https://v2.steemconnect.com/oauth2/authorize?client_id=None&scope=login,vote&redirect_uri=localhost
'
)
else
:
self
.
assertEqual
(
url
,
'
https://v2.steemconnect.com/oauth2/authorize?client_id=None&redirect_uri=localhost&scope=login,vote
'
)
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