|
1 | | -#!/usr/bin/env python3 |
2 | | -import os |
3 | | -import io |
4 | | -import unittest |
5 | | -from src.lighthouseweb3 import Lighthouse |
6 | | -from src.lighthouseweb3.functions.utils import NamedBufferedReader |
7 | | -from .setup import parse_env |
8 | | -import string |
9 | | -import secrets |
| 1 | +# #!/usr/bin/env python3 |
| 2 | +# import os |
| 3 | +# import io |
| 4 | +# import unittest |
| 5 | +# from src.lighthouseweb3 import Lighthouse |
| 6 | +# from src.lighthouseweb3.functions.utils import NamedBufferedReader |
| 7 | +# from .setup import parse_env |
| 8 | +# import string |
| 9 | +# import secrets |
10 | 10 |
|
11 | 11 |
|
12 | | -def generate_random_string(length: int) -> str: |
13 | | - characters = string.ascii_letters + string.digits |
14 | | - return ''.join(secrets.choice(characters) for _ in range(length)) |
| 12 | +# def generate_random_string(length: int) -> str: |
| 13 | +# characters = string.ascii_letters + string.digits |
| 14 | +# return ''.join(secrets.choice(characters) for _ in range(length)) |
15 | 15 |
|
16 | 16 |
|
17 | | -class TestUpload(unittest.TestCase): |
18 | | - def setUp(self) -> None: |
19 | | - """setup test environment""" |
20 | | - parse_env() |
| 17 | +# class TestUpload(unittest.TestCase): |
| 18 | +# def setUp(self) -> None: |
| 19 | +# """setup test environment""" |
| 20 | +# parse_env() |
21 | 21 |
|
22 | | - def test_env(self): |
23 | | - """test env var""" |
24 | | - self.assertNotEqual( |
25 | | - os.environ.get("LIGHTHOUSE_TOKEN"), None, "token is not None" |
26 | | - ) |
| 22 | +# def test_env(self): |
| 23 | +# """test env var""" |
| 24 | +# self.assertNotEqual( |
| 25 | +# os.environ.get("LIGHTHOUSE_TOKEN"), None, "token is not None" |
| 26 | +# ) |
27 | 27 |
|
28 | | - def test_Upload_file(self): |
29 | | - """test Upload function""" |
30 | | - l = Lighthouse() # will use env var |
31 | | - res = l.upload("tests/testdir/testfile.txt") |
32 | | - self.assertNotEqual(res.get("data"), None, "data is None") |
33 | | - self.assertNotEqual(res.get("data").get("Hash"), None, "data is None") |
| 28 | +# def test_Upload_file(self): |
| 29 | +# """test Upload function""" |
| 30 | +# l = Lighthouse() # will use env var |
| 31 | +# res = l.upload("tests/testdir/testfile.txt") |
| 32 | +# self.assertNotEqual(res.get("data"), None, "data is None") |
| 33 | +# self.assertNotEqual(res.get("data").get("Hash"), None, "data is None") |
34 | 34 |
|
35 | | - def test_Upload_dir(self): |
36 | | - """test Upload function""" |
37 | | - l = Lighthouse(os.environ.get("LIGHTHOUSE_TOKEN")) |
38 | | - res = l.upload("tests/testdir/") |
39 | | - self.assertNotEqual(res.get("data"), None, "data is None") |
40 | | - self.assertIsInstance(res.get("data"), dict, "data is a dict") |
41 | | - self.assertNotEqual(res.get("data").get("Hash"), None, "data is None") |
| 35 | +# def test_Upload_dir(self): |
| 36 | +# """test Upload function""" |
| 37 | +# l = Lighthouse(os.environ.get("LIGHTHOUSE_TOKEN")) |
| 38 | +# res = l.upload("tests/testdir/") |
| 39 | +# self.assertNotEqual(res.get("data"), None, "data is None") |
| 40 | +# self.assertIsInstance(res.get("data"), dict, "data is a dict") |
| 41 | +# self.assertNotEqual(res.get("data").get("Hash"), None, "data is None") |
42 | 42 |
|
43 | | - def test_Upload_Blob(self): |
44 | | - """test Upload function""" |
45 | | - l = Lighthouse(os.environ.get("LIGHTHOUSE_TOKEN")) |
46 | | - res = l.uploadBlob( |
47 | | - io.BytesIO(b"tests/testdir/"), f"{generate_random_string(16)}.txt") |
48 | | - self.assertNotEqual(res.get("data"), None, "data is None") |
49 | | - self.assertIsInstance(res.get("data"), dict, "data is a dict") |
50 | | - self.assertNotEqual(res.get("data").get("Hash"), None, "data is None") |
| 43 | +# def test_Upload_Blob(self): |
| 44 | +# """test Upload function""" |
| 45 | +# l = Lighthouse(os.environ.get("LIGHTHOUSE_TOKEN")) |
| 46 | +# res = l.uploadBlob( |
| 47 | +# io.BytesIO(b"tests/testdir/"), f"{generate_random_string(16)}.txt") |
| 48 | +# self.assertNotEqual(res.get("data"), None, "data is None") |
| 49 | +# self.assertIsInstance(res.get("data"), dict, "data is a dict") |
| 50 | +# self.assertNotEqual(res.get("data").get("Hash"), None, "data is None") |
51 | 51 |
|
52 | | - def test_Upload_File(self): |
53 | | - """test Upload function""" |
54 | | - l = Lighthouse(os.environ.get("LIGHTHOUSE_TOKEN")) |
55 | | - with open("./.gitignore", "rb") as file: |
56 | | - res = l.upload(file) |
57 | | - self.assertNotEqual(res.get("data"), None, "data is None") |
58 | | - self.assertIsInstance(res.get("data"), dict, "data is a dict") |
59 | | - self.assertNotEqual(res.get("data").get( |
60 | | - "Hash"), None, "data is None") |
| 52 | +# def test_Upload_File(self): |
| 53 | +# """test Upload function""" |
| 54 | +# l = Lighthouse(os.environ.get("LIGHTHOUSE_TOKEN")) |
| 55 | +# with open("./.gitignore", "rb") as file: |
| 56 | +# res = l.upload(file) |
| 57 | +# self.assertNotEqual(res.get("data"), None, "data is None") |
| 58 | +# self.assertIsInstance(res.get("data"), dict, "data is a dict") |
| 59 | +# self.assertNotEqual(res.get("data").get( |
| 60 | +# "Hash"), None, "data is None") |
61 | 61 |
|
62 | 62 |
|
63 | | -if __name__ == "__main__": |
64 | | - unittest.main() |
| 63 | +# if __name__ == "__main__": |
| 64 | +# unittest.main() |
0 commit comments