-
Notifications
You must be signed in to change notification settings - Fork 0
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
229 additions
and
15 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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from django.test import SimpleTestCase | ||
|
||
from anchor.models.base import SHORT_UUID_ALPHABET, SHORT_UUID_LENGTH, _gen_short_uuid | ||
|
||
|
||
class TestGenShortUuid(SimpleTestCase): | ||
def test_gen_short_uuid(self): | ||
for _ in range(1000): | ||
self.assertEqual(len(_gen_short_uuid()), SHORT_UUID_LENGTH) | ||
self.assertTrue( | ||
all(c.encode("ascii") in SHORT_UUID_ALPHABET for c in _gen_short_uuid()) | ||
) |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from django.test import SimpleTestCase | ||
|
||
from anchor.support.base58 import b58encode, b58encode_int | ||
|
||
|
||
class Base58Test(SimpleTestCase): | ||
def test_b58encode_int(self): | ||
self.assertEqual(b58encode_int(0), b"1") | ||
self.assertEqual(b58encode_int(0, default_one=False), b"") | ||
|
||
def test_b58encode(self): | ||
self.assertEqual(b58encode(b"hello"), b"Cn8eVZg") |
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