# Path: responsebot/models.py
# class List(object):
#     """
#     Represent a user list.
#     """
#     def __init__(self, data):
#         """
#         :param data: Parsed JSON data
#         :type data: dictionary
#         """
#         self.raw_data = data
# 
#         for key, value in data.items():
#             if key == 'user':
#                 setattr(self, key, User(value))
#             elif key == 'created_at':
#                 setattr(self, key, parse(value))
#             else:
#                 setattr(self, key, value)
# 
# class User(object):
#     """
#     Represents a user. E.g. you can get a user's screen name via it's :code:`screen_name` property
#     (:code:`user.screen_name`). All properties except :code:`status` have the same name as Twitter defined them `here
#     <https://dev.twitter.com/overview/api/users>`_. :code:`status` is renamed to :code:`tweet`.
#     """
#     def __init__(self, data):
#         """
#         :param data: Parsed JSON data
#         :type data: dictionary
#         """
#         self.raw_data = data
# 
#         for key, value in data.items():
#             if key == 'created_at':
#                 setattr(self, key, parse(value))
#             elif key == 'status':
#                 setattr(self, 'tweet', Tweet(value))
#             elif key == 'following':
#                 setattr(self, key, value is True)
#             else:
#                 setattr(self, key, value)


from unittest.case import TestCase
from dateutil.parser import parse
from responsebot.models import List, User




class ListModelTestCase(TestCase):
    def test_parse_list(self):
        created_at = 'Mon Apr 25 08:25:58 +0000 2016'
        raw = {
            'some_key': 'some value',
            'created_at': created_at,
            'user': {
                'screen_name': 'some_one'
            }
        }

        expected_created_at = parse(created_at)

        list = List(raw)

        self.assertEqual(list.some_key, 'some value')
        self.assertEqual(list.created_at, expected_created_at)


# Path: responsebot/models.py
# class List(object):
#     """
#     Represent a user list.
#     """
#     def __init__(self, data):
#         """
#         :param data: Parsed JSON data
#         :type data: dictionary
#         """
#         self.raw_data = data
# 
#         for key, value in data.items():
#             if key == 'user':
#                 setattr(self, key, User(value))
#             elif key == 'created_at':
#                 setattr(self, key, parse(value))
#             else:
#                 setattr(self, key, value)
# 
# class User(object):
#     """
#     Represents a user. E.g. you can get a user's screen name via it's :code:`screen_name` property
#     (:code:`user.screen_name`). All properties except :code:`status` have the same name as Twitter defined them `here
#     <https://dev.twitter.com/overview/api/users>`_. :code:`status` is renamed to :code:`tweet`.
#     """
#     def __init__(self, data):
#         """
#         :param data: Parsed JSON data
#         :type data: dictionary
#         """
#         self.raw_data = data
# 
#         for key, value in data.items():
#             if key == 'created_at':
#                 setattr(self, key, parse(value))
#             elif key == 'status':
#                 setattr(self, 'tweet', Tweet(value))
#             elif key == 'following':
#                 setattr(self, key, value is True)
#             else:
#                 setattr(self, key, value)


# Path: tests/unit_tests/models/test_list_model.py
from unittest.case import TestCase
from dateutil.parser import parse
from responsebot.models import List, User





class ListModelTestCase(TestCase):
    def test_parse_list(self):
        created_at = 'Mon Apr 25 08:25:58 +0000 2016'
        raw = {
            'some_key': 'some value',
            'created_at': created_at,
            'user': {
                'screen_name': 'some_one'
            }
        }

        expected_created_at = parse(created_at)

        list = List(raw)

        self.assertEqual(list.some_key, 'some value')
        self.assertEqual(list.created_at, expected_created_at)


        self.assertTrue(isinstance(list.user, User))