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

chift-oneapi / chift-python-sdk / 7666915815

26 Jan 2024 10:18AM UTC coverage: 98.637%. First build
7666915815

push

github

hhertoghe
reformat

3112 of 3155 relevant lines covered (98.64%)

0.99 hits per line

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

96.0
/tests/test_connection.py
1
import pytest
1✔
2

3
from chift.api.exceptions import ChiftException
1✔
4
from chift.openapi.models import Consumer
1✔
5

6

7
def test_find_one_evoliz_connection(chift):
1✔
8
    consumers = chift.Consumer.all()
1✔
9

10
    for consumer in consumers:
1✔
11
        connections = consumer.Connection.all()
1✔
12

13
        for connection in connections:
1✔
14
            if connection.integration == "Evoliz":
1✔
15
                return
1✔
16

17
    raise Exception("No connection found for Evoliz.")
×
18

19

20
def test_multi_connections(two_connections_consumer: Consumer):
1✔
21
    # a consumer with 2 connections
22
    consumer = two_connections_consumer
1✔
23

24
    # will raise if no connectionid is set
25
    with pytest.raises(ChiftException) as e:
1✔
26
        consumer.invoicing.Invoice.all()
1✔
27

28
    assert e.value.message == "The connection is not correctly configured"
1✔
29

30
    connections = consumer.Connection.all()
1✔
31
    active_connection = list(
1✔
32
        filter(lambda conn: conn.status.value == "active", connections)
33
    )
34

35
    # will find invoices if one of the consumers set
36
    consumer.connectionid = str(active_connection[0].connectionid)
1✔
37
    invoices = consumer.invoicing.Invoice.all()
1✔
38
    invoice = invoices[0]
1✔
39

40
    # will raise if we try to find the invoice of one connection in the other
41
    consumer.connectionid = str(active_connection[1].connectionid)
1✔
42
    with pytest.raises(ChiftException) as e:
1✔
43
        consumer.invoicing.Invoice.get(invoice.id)
1✔
44

45
    assert e.value.message == "The invoice doesn't exist."
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