forked from Shopify/shopify_python_api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvariant_test.py
More file actions
49 lines (41 loc) · 1.72 KB
/
Copy pathvariant_test.py
File metadata and controls
49 lines (41 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import shopify
from test.test_helper import TestCase
class VariantTest(TestCase):
def test_get_variants(self):
self.fake("products/632910392/variants", method="GET", body=self.load_fixture("variants"))
v = shopify.Variant.find(product_id=632910392)
def test_get_variant_namespaced(self):
self.fake("products/632910392/variants/808950810", method="GET", body=self.load_fixture("variant"))
v = shopify.Variant.find(808950810, product_id=632910392)
def test_update_variant_namespace(self):
self.fake("products/632910392/variants/808950810", method="GET", body=self.load_fixture("variant"))
v = shopify.Variant.find(808950810, product_id=632910392)
self.fake(
"products/632910392/variants/808950810",
method="PUT",
body=self.load_fixture("variant"),
headers={"Content-type": "application/json"},
)
v.save()
def test_create_variant(self):
self.fake(
"products/632910392/variants",
method="POST",
body=self.load_fixture("variant"),
headers={"Content-type": "application/json"},
)
v = shopify.Variant({"product_id": 632910392})
v.save()
def test_create_variant_then_add_parent_id(self):
self.fake(
"products/632910392/variants",
method="POST",
body=self.load_fixture("variant"),
headers={"Content-type": "application/json"},
)
v = shopify.Variant()
v.product_id = 632910392
v.save()
def test_get_variant(self):
self.fake("variants/808950810", method="GET", body=self.load_fixture("variant"))
v = shopify.Variant.find(808950810)