Skip to content

Commit

Permalink
Improove test_project tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kipanshi committed Oct 8, 2012
1 parent fd90333 commit 2c14322
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 19 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist/
aldjemy.egg-info/
*.pyc
ve/
8 changes: 3 additions & 5 deletions test_project/a_sample/models.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from django.db import models as m
from sample.models import G
from sample.models import Book

# Create your models here.

class GP(G):
class BookProxy(Book):
class Meta:
proxy=True
proxy = True
29 changes: 19 additions & 10 deletions test_project/sample/models.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
from django.db import models as m
from django.db import models

# Create your models here.

class G(m.Model):
a = m.CharField(max_length="200")
class Chapter(models.Model):
title = models.CharField(max_length=200)
book = models.ForeignKey('Book')


class M(m.Model):
a = m.CharField(max_length="200")
b = m.TextField()
class Book(models.Model):
title = models.CharField(max_length=200)

g = m.ManyToManyField(G, related_name='cc_lprojects')

class MN(M):
c = m.TextField()
class Author(models.Model):
name = models.CharField(max_length=200)
biography = models.TextField()

books = models.ManyToManyField(Book, related_name='books')


class StaffAuthor(Author):
role = models.TextField()


class Review(models.Model):
book = models.ForeignKey('a_sample.BookProxy')
10 changes: 8 additions & 2 deletions test_project/sample/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@
"""

from django.test import TestCase
from sample.models import G
from sample.models import Chapter, Book, Author, StaffAuthor, Review
from a_sample.models import BookProxy


class SimpleTest(TestCase):
def test_aldjemy_initialization(self):
self.assertTrue(G.sa)
self.assertTrue(Chapter.sa)
self.assertTrue(Book.sa)
self.assertTrue(Author.sa)
self.assertTrue(StaffAuthor.sa)
self.assertTrue(Review.sa)
self.assertTrue(BookProxy.sa)
4 changes: 2 additions & 2 deletions test_project/test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from sample.models import MN
from sample.models import StaffAuthor

print MN.sa.query().all()
print StaffAuthor.sa.query().all()

0 comments on commit 2c14322

Please sign in to comment.