cic-cli/tests/test_meta.py

56 lines
1.1 KiB
Python
Raw Permalink Normal View History

2021-10-11 12:27:51 +02:00
# standard imports
import logging
import os
2022-02-21 06:34:25 +01:00
import unittest
2021-10-11 12:27:51 +02:00
# local imports
from cic.meta import Meta
2021-10-11 12:27:51 +02:00
2022-02-21 06:34:25 +01:00
# external imports
from hexathon import strip_0x
2021-10-11 12:27:51 +02:00
# test imports
2022-02-21 06:34:25 +01:00
from tests.base_cic import TestCICBase, test_data_dir
2021-10-11 12:27:51 +02:00
logging.basicConfig(level=logging.DEBUG)
logg = logging.getLogger()
class TestCICMeta(TestCICBase):
def test_meta(self):
2022-02-21 06:34:25 +01:00
fp = os.path.join(test_data_dir, "proof")
m = Meta(fp)
m.load()
2022-02-21 06:34:25 +01:00
self.assertEquals(
str(m),
"""name = Test
contact.phone = 0700-123456
country_code = KE
location = Kilifi
""",
)
def test_meta_with_initial_values(self):
fp = os.path.join(test_data_dir, "proof")
m = Meta(
fp,
name="TestName",
location="TestLocation",
country_code="TestCC",
contact={
"phone": "0723578455158",
},
)
self.assertEquals(
str(m),
"""name = TestName
contact.phone = 0723578455158
country_code = TestCC
location = TestLocation
""",
)
2021-10-11 12:27:51 +02:00
2022-02-21 06:34:25 +01:00
if __name__ == "__main__":
2021-10-11 12:27:51 +02:00
unittest.main()