*def webhook_register(request, organization_pk, campaign_id):    user_id =
Campaign.objects.filter(id=campaign_id)    user_id =
user_id[0].__dict__["user_id"]    # social_user_details =
UserSocialAuth.objects.filter(provider=request.GET["provider"],
user_id=user_id)    social_user_details =
UserSocialAuth.objects.filter(provider="shopify", user_id=user_id)    shop
= social_user_details[0].__dict__['extra_data']['shop']
SOCIAL_AUTH_ACCESS_TOKEN =
social_user_details[0].__dict__['extra_data']['access_token']    # shop =
'store-adi.myshopify.com <http://store-adi.myshopify.com>'    headers = {
      "X-Shopify-Access-Token": SOCIAL_AUTH_ACCESS_TOKEN,        "Accept":
"application/json",        "Content-Type": "application/json",    }
payload = {        "webhook": {            "topic": "orders/create",
    "address": "https://%s/webhook/receiver/shopify/%s"; % (NGROK_DOMAIN,
campaign_id),            "format": "json"        }    }    response =
requests.post("https://"; + shop + "/admin/api/2019-10/webhooks.json",
data=json.dumps(payload),                             headers=headers)   #
print(response.content)    return HttpResponse('success')*


*i am writing unitest for the above function,there are some Factory and
fakers method is used. I am looking how i can convert this *
user_id = Campaign.objects.filter(id=campaign_id)

to equivalent statment for unit test using  CampaignFactory method .



*Thanks*,
*Saswat*

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEhPkLEVGr6P4w78KD%2BPbP0%3DeNYFcFWQZaFOAyQJm_GkGJjGVw%40mail.gmail.com.

Reply via email to