-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
157 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
aaa | ||
bbb | ||
ccc | ||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | ||
0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb | ||
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from eth_validator_watcher.utils import eth1_address_0x_prefixed | ||
from pytest import raises | ||
|
||
|
||
def test_eth1_address_0x_prefixed_invalid() -> None: | ||
# Too short | ||
with raises(ValueError): | ||
eth1_address_0x_prefixed("0x123") | ||
|
||
# Too long | ||
with raises(ValueError): | ||
eth1_address_0x_prefixed( | ||
"0x123456789012345678901234567890123456789012345678901234567890123" | ||
) | ||
|
||
# Invalid character | ||
with raises(ValueError): | ||
eth1_address_0x_prefixed("0x8d8b1b85d02d05ad3a14e2e9cc7b458d5invalid") | ||
|
||
|
||
def test_eth1_address_0x_prefixed_valid_already_prefixed() -> None: | ||
address = "0x8d8b1b85d02d05ad3a14e2e9cc7b458d5c7d8f8c" | ||
assert eth1_address_0x_prefixed(address) == address | ||
|
||
|
||
def test_eth1_address_0x_prefixed_valid_not_already_prefixed() -> None: | ||
address_without_prefix = "8d8b1b85d02d05ad3a14e2e9cc7b458d5c7d8f8c" | ||
address_with_prefix = "0x8d8b1b85d02d05ad3a14e2e9cc7b458d5c7d8f8c" | ||
assert eth1_address_0x_prefixed(address_without_prefix) == address_with_prefix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from eth_validator_watcher.utils import eth2_address_0x_prefixed | ||
from pytest import raises | ||
|
||
|
||
def test_eth2_address_0x_prefixed_invalid() -> None: | ||
# Too short | ||
with raises(ValueError): | ||
eth2_address_0x_prefixed("0x123") | ||
|
||
# Too long | ||
with raises(ValueError): | ||
eth2_address_0x_prefixed( | ||
"0x123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" | ||
) | ||
|
||
# Invalid character | ||
with raises(ValueError): | ||
eth2_address_0x_prefixed("0x8d8b1b85d02d05ad3a14e2e9cc7b458d5invalid") | ||
|
||
|
||
def test_eth2_address_0x_prefixed_valid_already_prefixed() -> None: | ||
address = "0xb2ddae7e32fd8257c2dd468ca16dc86d310cab218f9a41ed6fabea525a9620d46955350776e8496553138c8a291a365b" | ||
assert eth2_address_0x_prefixed(address) == address | ||
|
||
|
||
def test_eth2_address_0x_prefixed_valid_not_already_prefixed() -> None: | ||
address_without_prefix = "b2ddae7e32fd8257c2dd468ca16dc86d310cab218f9a41ed6fabea525a9620d46955350776e8496553138c8a291a365b" | ||
address_with_prefix = "0xb2ddae7e32fd8257c2dd468ca16dc86d310cab218f9a41ed6fabea525a9620d46955350776e8496553138c8a291a365b" | ||
assert eth2_address_0x_prefixed(address_without_prefix) == address_with_prefix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters