56 lines
1.1 KiB
Python
56 lines
1.1 KiB
Python
# standard imports
|
|
import logging
|
|
import os
|
|
import unittest
|
|
|
|
# local imports
|
|
from cic.meta import Meta
|
|
|
|
# external imports
|
|
from hexathon import strip_0x
|
|
|
|
# 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()
|