• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

chift-oneapi / chift-python-sdk / 6786875963

07 Nov 2023 03:44PM UTC coverage: 99.032%. First build
6786875963

Pull #22

github

web-flow
Merge bc754f425 into c1e063f63
Pull Request #22: [0.1.23] fix accounting/invoices params

14 of 16 new or added lines in 3 files covered. (87.5%)

2864 of 2892 relevant lines covered (99.03%)

0.99 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.83
/tests/test_pos.py
1
import uuid
1✔
2

3
import pytest
1✔
4

5
from chift.api.exceptions import ChiftException
1✔
6
from chift.openapi.models import Consumer
1✔
7

8

9
def test_contact(pos_consumer: Consumer):
1✔
10
    consumer = pos_consumer
1✔
11

12
    # create contact
13
    data = {
1✔
14
        "first_name": str(uuid.uuid1()),
15
        "last_name": str(uuid.uuid1()),
16
        "email": f"{str(uuid.uuid1())}@test.com",
17
    }
18
    expected_contact = consumer.pos.Customer.create(data)
1✔
19

20
    assert expected_contact.id, "create() failed"
1✔
21

22
    # find it back with its id
23
    actual_contact = consumer.pos.Customer.get(str(expected_contact.id))
1✔
24

25
    assert expected_contact == actual_contact, "get() failed"
1✔
26

27

28
def test_contact_all(pos_consumer: Consumer):
1✔
29
    consumer = pos_consumer
1✔
30
    contacts = consumer.pos.Customer.all(limit=2)
1✔
31

32
    assert contacts
1✔
33

34
    for contact in contacts:
1✔
35
        assert contact.first_name
1✔
36

37

38
def test_payment_methods_all(pos_consumer: Consumer):
1✔
39
    consumer = pos_consumer
1✔
40
    payments = consumer.pos.PaymentMethod.all(limit=2)
1✔
41

42
    assert payments
1✔
43

44
    for payment in payments:
1✔
45
        assert payment.name
1✔
46

47

48
def test_sales_all(pos_consumer: Consumer):
1✔
49
    consumer = pos_consumer
1✔
50
    sales = consumer.pos.Sale.all(
1✔
51
        params={"date_from": "2023-01-08", "date_to": "2023-01-01"}, limit=2
52
    )
53

54
    for sale in sales:  # probably no sale in given timeframe
1✔
55
        assert sale.total
×
56

57

58
def test_payment(pos_consumer: Consumer):
1✔
59
    consumer = pos_consumer
1✔
60

61
    with pytest.raises(ChiftException) as e:
1✔
62
        consumer.pos.Payment.all(
1✔
63
            params={"date_from": "2023-01-08", "date_to": "2023-01-01"}, limit=2
64
        )
65

66
    assert e.value.message == "API Resource does not exist"
1✔
67

68

69
def test_location(pos_consumer: Consumer):
1✔
70
    consumer = pos_consumer
1✔
71

72
    locations = consumer.pos.Location.all(limit=2)
1✔
73

74
    assert locations
1✔
75

76
    for location in locations:
1✔
77
        assert location.id
1✔
78

79

80
def test_order(pos_consumer: Consumer):
1✔
81
    consumer = pos_consumer
1✔
82

83
    orders = consumer.pos.Order.all(
1✔
84
        {"date_from": "2023-01-08", "date_to": "2023-01-01"}
85
    )
86

87
    for order in orders:  # probably no order in given timeframe
1✔
88
        assert order == consumer.pos.Order.get(order.id)
×
89

90

91
def test_closure(pos_consumer: Consumer):
1✔
92
    consumer = pos_consumer
1✔
93

94
    closure = consumer.pos.Closure.get("2023-01-01")
1✔
95

96
    assert closure.status
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc