# Path: attendance/models.py
# class SSIDName(models.Model):
#     name = models.CharField(max_length=30)
# 
#     def generate_random_name(self):
#         size = random.randint(10, 17)
#         chars = string.ascii_lowercase + string.digits
#         self.name = ''.join(random.choice(chars) for _ in range(size))
# 
#     def __str__(self):
#         return self.name
# 
# class DailyAttendance(models.Model):
#     """
#     attendance = { "2016": {"user_id": [1, s_time, e_time], "user_id": [0, s_time, e_time]}  }
#     """
#     date = models.DateField()
#     attendance = JSONField()
# 
#     def __str__(self):
#         return str(self.date)


from datetime import datetime
from django.test import TestCase
from attendance.models import SSIDName, DailyAttendance

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

    def test_add_attendance(self):
        """
        Tests adding yearly attendance
        """
        pass

    def test_attendance_to_user_list(self):
        """
        Test retrieval user list
        expected: [ [user, attendance], [user, attendance] ]
        """
        pass

    def test_attendance_to_percentage(self):
        pass


class SSIDNameTest(TestCase):
    def setUp(self):
        self.ssid = SSIDName()
        self.ssid.generate_random_name()

    def test_add_attachment(self):
        self.assertEqual(SSIDName.objects.count(), 0)
        self.ssid.save()

# Path: attendance/models.py
# class SSIDName(models.Model):
#     name = models.CharField(max_length=30)
# 
#     def generate_random_name(self):
#         size = random.randint(10, 17)
#         chars = string.ascii_lowercase + string.digits
#         self.name = ''.join(random.choice(chars) for _ in range(size))
# 
#     def __str__(self):
#         return self.name
# 
# class DailyAttendance(models.Model):
#     """
#     attendance = { "2016": {"user_id": [1, s_time, e_time], "user_id": [0, s_time, e_time]}  }
#     """
#     date = models.DateField()
#     attendance = JSONField()
# 
#     def __str__(self):
#         return str(self.date)


# Path: attendance/tests.py
from datetime import datetime
from django.test import TestCase
from attendance.models import SSIDName, DailyAttendance


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

    def test_add_attendance(self):
        """
        Tests adding yearly attendance
        """
        pass

    def test_attendance_to_user_list(self):
        """
        Test retrieval user list
        expected: [ [user, attendance], [user, attendance] ]
        """
        pass

    def test_attendance_to_percentage(self):
        pass


class SSIDNameTest(TestCase):
    def setUp(self):
        self.ssid = SSIDName()
        self.ssid.generate_random_name()

    def test_add_attachment(self):
        self.assertEqual(SSIDName.objects.count(), 0)
        self.ssid.save()

        self.assertEqual(SSIDName.objects.count(), 1)