cic-cli/tests/test_meta.py

56 lines
1.1 KiB
Python

# standard imports
import unittest
import logging
import os
# external imports
from hexathon import strip_0x
# local imports
from cic.contract.components.meta import Meta
# test imports
from tests.base_cic import TestCICBase, test_data_dir
logging.basicConfig(level=logging.DEBUG)
logg = logging.getLogger()
class TestCICMeta(TestCICBase):
def test_meta(self):
fp = os.path.join(test_data_dir, "proof")
m = Meta(fp)
m.load()
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
""",
)
if __name__ == "__main__":
unittest.main()