Ejemplo n.º 1
0
 def test_local_key_is_considered_modified_field_with_id_assign(self):
     article = LKArticle(name='A', author=None)
     author = LKAuthor(name='A')
     setattr(author, '_is_new', False)
     setattr(article, '_is_new', False)
     article.author_id = author.id
     self.assertEqual(article.modified_fields, ('author',))
Ejemplo n.º 2
0
 def test_local_key_is_set_to_none_then_object_is_set_to_none(self):
     author = LKAuthor(name='A')
     article = LKArticle(name='A', author=author)
     self.assertEqual(article.author, author)
     self.assertEqual(author.articles[0], article)
     article.author_id = None
     self.assertEqual(article.author, None)
     self.assertEqual(author.articles, [])
Ejemplo n.º 3
0
 def test_set_local_key_resets_object(self):
     author = LKAuthor(name='A')
     article = LKArticle(name='A', author=author)
     self.assertEqual(article.author, author)
     self.assertEqual(author.articles[0], article)
     article.author_id = 500
     self.assertEqual(article.author, None)
     self.assertEqual(author.articles, [])