# Path: doac/models.py
# class Client(models.Model):
#     name = models.CharField(max_length=255)
#     secret = models.CharField(
#         max_length=options.client["length"],
#         blank=True,
#         help_text=AUTO_GENERATION_HELP_TEXT,
#     )
#     access_host = models.URLField(max_length=255)
#     is_active = models.BooleanField(default=True)
# 
#     objects = managers.ClientManager()
# 
#     def __unicode__(self):
#         return self.name
# 
#     def generate_secret(self):
#         from .compat import get_random_string
# 
#         return get_random_string(options.client["length"])
# 
#     def save(self, *args, **kwargs):
#         if not self.secret:
#             self.secret = self.generate_secret()
# 
#         super(Client, self).save(*args, **kwargs)


from django.test import TestCase
from doac.models import Client


class TestClientModel(TestCase):

    def test_unicode(self):
        client = Client(name="Test Client", access_host="http://localhost/")
        client.save()

        self.assertEqual(unicode(client), client.name)

    def test_generate_secret(self):

# Path: doac/models.py
# class Client(models.Model):
#     name = models.CharField(max_length=255)
#     secret = models.CharField(
#         max_length=options.client["length"],
#         blank=True,
#         help_text=AUTO_GENERATION_HELP_TEXT,
#     )
#     access_host = models.URLField(max_length=255)
#     is_active = models.BooleanField(default=True)
# 
#     objects = managers.ClientManager()
# 
#     def __unicode__(self):
#         return self.name
# 
#     def generate_secret(self):
#         from .compat import get_random_string
# 
#         return get_random_string(options.client["length"])
# 
#     def save(self, *args, **kwargs):
#         if not self.secret:
#             self.secret = self.generate_secret()
# 
#         super(Client, self).save(*args, **kwargs)


# Path: tests/tests/models/test_client.py
from django.test import TestCase
from doac.models import Client



class TestClientModel(TestCase):

    def test_unicode(self):
        client = Client(name="Test Client", access_host="http://localhost/")
        client.save()

        self.assertEqual(unicode(client), client.name)

    def test_generate_secret(self):

        client = Client(name="Test Client", access_host="http://localhost/")