Example #1
0
    def test_is_saved_in_database_returs_false_for_pending_object(self):
        instance = HyperlinkedRelatedField(view_name='user-detail')
        session = SESSION()

        user = self.TestHyperlinkedRelatedFieldUserModel(name='test_admin')
        session.add(user)
        self.assertFalse(instance.is_saved_in_database(user))

        session.close()
Example #2
0
    def test_is_saved_in_database_returs_true(self):
        instance = HyperlinkedRelatedField(view_name='user-detail')
        session = SESSION()

        user = session.query(self.TestHyperlinkedRelatedFieldUserModel) \
                      .filter_by(name='admin').first()
        self.assertTrue(instance.is_saved_in_database(user))

        session.close()
Example #3
0
    def test_is_saved_in_database_returs_false_for_transient_object(self):
        instance = HyperlinkedRelatedField(view_name='user-detail')

        user = self.TestHyperlinkedRelatedFieldUserModel(name='test_admin')
        self.assertFalse(instance.is_saved_in_database(user))