Ejemplo n.º 1
0
def get_user_and_add_facebook_id():
    owner = User.objects.get(id=1)
    # This if/else is here because of what seems to be a quirk by Django:
    # Profile exists, when running this TestCase class separately,
    # but Profile does not exist when running all the tests together (python manage.py test)
    if len(Profile.objects.all()) == 0:
        owner_profile = Profile(id=1, user=owner)
    else:
        owner_profile = Profile.objects.get(user=owner)
    owner_profile.facebook_id = 'foo'
    owner_profile.save()
    return owner