'Operations that involve sharing FK objects across databases raise an error'

def test_o2o_cross_database_protection(self):

    alice = User.objects.db_manager(u'default').create_user(u'alice', u'alice@example.com')
    bob = User.objects.db_manager(u'other').create_user(u'bob', u'bob@example.com')
    alice_profile = UserProfile.objects.create(user=alice, flavor=u'chocolate')
    try:
        bob.userprofile = alice_profile
    except ValueError:
        self.fail(u'Assignment    across    master/slave    databases    with    a    common    source    should    be    ok')
    self.assertEqual(alice._state.db, u'default')
    self.assertEqual(alice_profile._state.db, u'default')
    self.assertEqual(bob._state.db, u'other')
    bob.save()
    self.assertEqual(bob._state.db, u'default')
