from django.test import TestCase
from ..services.user_service import UserService
from ..services.user_detail_info_service import DetailInfoService
from ..utils.j_ulid_field import JULIDField
import datetime
from ulid import ULID


class TestExtension(TestCase):
    def setUp(self):
        pass

    __right = {
        "account": 'u001',
    }

    # def test_add(self):
    #     result, err = UserService.user_add(self.__right)
    #     print("> UserBaseTest: test_add:", result, err)
    #     self.assertEqual(err, None)

    def test_detail(self):
        exist, err = UserService.user_add(self.__right)
        print("> TestExtension: test_detail 1:", exist, err)
        result, err = DetailInfoService.get_detail(exist['id'])
        print("> TestExtension: test_detail:", result, err)
        self.assertEqual(err, None)

    # def test_edit(self):
    #     UserService.user_add(self.__right)
    #     exist, err = UserService.check_account(self.__right['account'])
    #     print("> UserBaseTest: test_edit: 1 exist:", exist)
    #     exist['fullname'] = '路乙'
    #     result, err = UserService.user_edit(exist, user_id=exist['user_id'])
    #     print("> UserBaseTest: test_edit: 2 result:", result)
    #     self.assertEqual(err, None)

    # def test_delete(self):
    #     UserService.user_add(self.__right)
    #     exist, err = UserService.check_account(self.__right['account'])
    #     print("> UserBaseTest: test_delete: 1 exist:", exist)
    #
    #     result, err = UserService.user_delete(exist['user_id'])
    #     print("> ThreadClassifyTest::test_delete:", result)
    #     self.assertEqual(err, None)