FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-bitshares/tests/test_message.py at develop · mikakoi/python-bitshares · GitHub
mikakoi
/
python-bitshares
Public
forked from
bitshares/python-bitshares
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
python-bitshares
/
tests
/
test_message.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
75 lines (65 loc) · 2.62 KB
Breadcrumbs
python-bitshares
/
tests
/
test_message.py
Copy path
File metadata and controls
75 lines (65 loc) · 2.62 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import
unittest
import
mock
from
bitshares
import
BitShares
from
bitshares
.
message
import
Message
from
bitshares
.
instance
import
set_shared_bitshares_instance
wif
=
"5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"
core_unit
=
"PPY"
class
Testcases
(
unittest
.
TestCase
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
().
__init__
(
*
args
,
**
kwargs
)
self
.
bts
=
BitShares
(
nobroadcast
=
True
,
wif
=
[
wif
]
)
set_shared_bitshares_instance
(
self
.
bts
)
def
test_sign_message
(
self
):
def
new_refresh
(
self
):
dict
.
__init__
(
self
, {
"name"
:
"init0"
,
"options"
: {
"memo_key"
:
"BTS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV"
}})
with
mock
.
patch
(
"bitshares.account.Account.refresh"
,
new
=
new_refresh
):
p
=
Message
(
"message foobar"
).
sign
()
Message
(
p
).
verify
()
def
test_verify_message
(
self
):
def
new_refresh
(
self
):
dict
.
__init__
(
self
, {
"name"
:
"init0"
,
"options"
: {
"memo_key"
:
"BTS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV"
}})
with
mock
.
patch
(
"bitshares.account.Account.refresh"
,
new
=
new_refresh
):
Message
(
"-----BEGIN BITSHARES SIGNED MESSAGE-----
\n
"
"message foobar
\n
"
"-----BEGIN META-----
\n
"
"account=init0
\n
"
"memokey=BTS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV
\n
"
"block=23814223
\n
"
"timestamp=2018-01-24T11:42:33
\n
"
"-----BEGIN SIGNATURE-----
\n
"
"2034f601e175a25cf9f60a828650301f57c9efab53929b6a82fb413feb8a786fcb3ba4238dd8bece03aee38526ee363324d43944d4a3f9dc624fbe53ef5f0c9a5e
\n
"
"-----END BITSHARES SIGNED MESSAGE-----
\n
"
).
verify
()
Message
(
"-----BEGIN BITSHARES SIGNED MESSAGE-----"
"message foobar
\n
"
"-----BEGIN META-----"
"account=init0
\n
"
"memokey=BTS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV
\n
"
"block=23814223
\n
"
"timestamp=2018-01-24T11:42:33"
"-----BEGIN SIGNATURE-----"
"2034f601e175a25cf9f60a828650301f57c9efab53929b6a82fb413feb8a786fcb3ba4238dd8bece03aee38526ee363324d43944d4a3f9dc624fbe53ef5f0c9a5e
\n
"
"-----END BITSHARES SIGNED MESSAGE-----"
).
verify
()
Back
|
FazBrowse Home
|
New Git URL