# Path: devmason_server/models.py
# class Build(models.Model):
#     project = models.ForeignKey(Project, related_name='builds')
#     success = models.BooleanField()
#     started = models.DateTimeField()
#     finished = models.DateTimeField()
#     host = models.CharField(max_length=250)
#     arch = models.CharField(max_length=250)
#     user = models.ForeignKey(User, blank=True, null=True, related_name='builds')
#     extra_info = JSONField()
# 
#     class Meta:
#         ordering = ['-finished']
# 
#     def __unicode__(self):
#         return u"Build %s for %s" % (self.pk, self.project)
# 
#     @models.permalink
#     def get_absolute_url(self):
#         return ('build_detail', [self.project.slug, self.pk])
# 
# class Project(models.Model):
#     name = models.CharField(max_length=200)
#     slug = models.SlugField(unique=True)
#     owner = models.ForeignKey(User, related_name='projects', blank=True, null=True)
# 
#     class Meta:
#         ordering = ['name']
# 
#     def __unicode__(self):
#         return self.name
# 
#     @models.permalink
#     def get_absolute_url(self):
#         return ('project_detail', [self.slug])


import pprint
import difflib
from django.contrib.auth.models import User
from django.test import TestCase, Client
from django.utils import simplejson
from ..models import Build, Project

class PonyTests(TestCase):
    urls = 'devmason_server.urls'
    fixtures = ['authtestdata', 'devmason_server_test_data']

    def setUp(self):
        # Make this class's test client have a default Accept: header to
        # trigger the dispatching to API methods.
        self.client = Client(HTTP_ACCEPT='application/json')

        # Tag us a build (this is hard from fixtures)

# Path: devmason_server/models.py
# class Build(models.Model):
#     project = models.ForeignKey(Project, related_name='builds')
#     success = models.BooleanField()
#     started = models.DateTimeField()
#     finished = models.DateTimeField()
#     host = models.CharField(max_length=250)
#     arch = models.CharField(max_length=250)
#     user = models.ForeignKey(User, blank=True, null=True, related_name='builds')
#     extra_info = JSONField()
# 
#     class Meta:
#         ordering = ['-finished']
# 
#     def __unicode__(self):
#         return u"Build %s for %s" % (self.pk, self.project)
# 
#     @models.permalink
#     def get_absolute_url(self):
#         return ('build_detail', [self.project.slug, self.pk])
# 
# class Project(models.Model):
#     name = models.CharField(max_length=200)
#     slug = models.SlugField(unique=True)
#     owner = models.ForeignKey(User, related_name='projects', blank=True, null=True)
# 
#     class Meta:
#         ordering = ['name']
# 
#     def __unicode__(self):
#         return self.name
# 
#     @models.permalink
#     def get_absolute_url(self):
#         return ('project_detail', [self.slug])


# Path: devmason_server/tests/test_api.py
import pprint
import difflib
from django.contrib.auth.models import User
from django.test import TestCase, Client
from django.utils import simplejson
from ..models import Build, Project


class PonyTests(TestCase):
    urls = 'devmason_server.urls'
    fixtures = ['authtestdata', 'devmason_server_test_data']

    def setUp(self):
        # Make this class's test client have a default Accept: header to
        # trigger the dispatching to API methods.
        self.client = Client(HTTP_ACCEPT='application/json')

        # Tag us a build (this is hard from fixtures)

        b = Build.objects.get(pk=1)