File: tests.py

package info (click to toggle)
python-django 1.2.3-3%2Bsqueeze10
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 29,064 kB
  • ctags: 20,458
  • sloc: python: 101,293; xml: 574; makefile: 149; sh: 121; sql: 7
file content (22 lines) | stat: -rw-r--r-- 935 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from django.test import TestCase
from django.db import connection
from models import Unmanaged1, Unmanaged2, Managed1

class ManyToManyUnmanagedTests(TestCase):
            
    def test_many_to_many_between_unmanaged(self):
        """
        The intermediary table between two unmanaged models should not be created.
        """
        table = Unmanaged2._meta.get_field('mm').m2m_db_table()
        tables = connection.introspection.table_names()
        self.assert_(table not in tables, "Table '%s' should not exist, but it does." % table)
        
    def test_many_to_many_between_unmanaged_and_managed(self):
        """
        An intermediary table between a managed and an unmanaged model should be created.
        """
        table = Managed1._meta.get_field('mm').m2m_db_table()
        tables = connection.introspection.table_names()
        self.assert_(table in tables, "Table '%s' does not exist." % table)