File: python3-smoketest

package info (click to toggle)
python-pyodata 1.11.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,280 kB
  • sloc: python: 7,170; xml: 947; makefile: 67; sh: 15
file content (22 lines) | stat: -rw-r--r-- 601 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh

cd "$AUTOPKGTEST_TMP"
cat > test.py << EOF
#!/usr/bin/python3

from pyodata import Client
from requests import Session


SERVICE_URL = 'http://services.odata.org/V2/Northwind/Northwind.svc/'
session = Session()

client = Client(SERVICE_URL, session)
customer = client.entity_sets.Customers.get_entities() \
           .filter(CompanyName__contains='Dollar').execute()
assert len(customer) == 1, 'Unexpected number of results'
assert customer[0].CompanyName == 'Bottom-Dollar Markets', \
       'Unexpected Company Name'
print(f'Company name: {customer[0].CompanyName}')
EOF
python3 test.py