Skip to content

Commit

Permalink
Test foreignkey related attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
macro1 committed Aug 7, 2014
1 parent c9842c8 commit 96a7aa9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion simple_history/tests/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
AdminProfile, Bookcase, MultiOneToOne, Poll, Choice, Restaurant, Person,
FileModel, Document, Book, HistoricalPoll, Library, State, AbstractBase,
ConcreteAttr, ConcreteUtil, SelfFK, Temperature, WaterLevel,
ExternalModel1, ExternalModel3, UnicodeVerboseName
ExternalModel1, ExternalModel3, UnicodeVerboseName, HistoricalChoice,
HistoricalState
)
from ..external.models import ExternalModel2, ExternalModel4

Expand Down Expand Up @@ -465,3 +466,11 @@ def test_invalid_bases(self):
invalid_bases = (AbstractBase, "InvalidBases")
for bases in invalid_bases:
self.assertRaises(TypeError, HistoricalRecords, bases=bases)

def test_import_related(self):
field_object = HistoricalChoice._meta.get_field_by_name('poll_id')[0]
self.assertEqual(field_object.related.model, HistoricalChoice)

def test_string_related(self):
field_object = HistoricalState._meta.get_field_by_name('library_id')[0]
self.assertEqual(field_object.related.model, HistoricalState)

0 comments on commit 96a7aa9

Please sign in to comment.