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

def test_o2o_cross_database_protection(self):

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