程序代写代做代考 python Environment

Environment
Setup
Operating System: Ubuntu 14.04.5 LTS
Developed in Python 3
Installed required dependency package

sudo pip3 install Pyro4
sudo pip3 install suds-py3
sudo easy_install3 pytz
sudo easy_install3 spyne

Check the installation:

➜ python3 –version
Python 3.4.3
➜ pip3 list|grep Pyro4
Pyro4 (4.57)
➜ pip3 list|grep suds
suds-py3 (1.3.3.0)
➜ pip3 list|grep spyne
spyne (2.12.14)
➜ pip3 list|grep pytz
pytz (2017.2)

Optional: install below software for easy manipulating multiple
terminals

sudo apt-get install terminator

File
Description

Filename Description

property.py Class definition for property

warehouse.py Implement operations for select by price range,postcode, store and delete

soapService.py Provide soap service for warehouse

employeeTest.py test entry for employee action

customerTest.py test entry for customer action

Test
Steps

Start
the
required
services

1. Start a new terminal, run below command to start pyro name server.

➜ pyro4-ns
Not starting broadcast server for localhost.
NS running on localhost:9090 (127.0.0.1)
Warning: HMAC key not set. Anyone can connect to this server!
URI = PYRO:Pyro.NameServer@localhost:9090

2. Start a new terminal, run warehouse remote object service:

➜ python3 warehouse.py
[Warehouse with content (dict_keys([‘a002’, ‘a001’]))]
Object <__main__.Warehouse object at 0x7fbf14d38240>:
uri = PYRO:obj_12699418aa2a4545b91fba4f0375315c@localhost:34168
name = property.warehouse
Pyro daemon running.

3. Start a new terminal, run warehouse soap service:

➜ python3 soapService.py

4. After soap service is launched, you can open a browser and visit
below link to check the wsdl definition for this soap service:

http://127.0.0.1:8000/?wsdl

Test
employee
actions

Start a new terminal, run employee test, There are two options for
test: auto and manual.

➜ python3 employeeTest.py
Please input the test option [auto, manual]:auto
auto test start
test warehouse.store for [Property: id: a003, owner: David, number: 333, postcode: A7D3H1, price: 300]
store ok

test warehouse.selectByPriceRange(150, 300)
result size=2
[Property: id: a002, owner: Stanley, number: 222, postcode: A3E3K1, price: 200]
[Property: id: a003, owner: David, number: 333, postcode: A7D3H1, price: 300]

test warehouse.selectByPostcode(“M5A0G4”)
result size=1
[Property: id: a001, owner: Jack, number: 111, postcode: M5A0G4, price: 100]

test warehouse.delete(“a002”)
delete ok

test warehouse.selectByPriceRange(150, 300)
result size=1
[Property: id: a003, owner: David, number: 333, postcode: A7D3H1, price: 300]

Please input the test option [auto, manual]:
Please input the test option [auto, manual]:manual
manual test start
Available action:
1: warehouse.selectByPriceRange
2: warehouse.selectByPostcode
3: warehouse.store
4: warehouse.delete
Please input the index of the action [1, 2, 3, 4]:1
Please input lowPriceInclusive:100
Please input highPriceInclusive:300
test warehouse.selectByPriceRange(100, 300)
result size=2
[Property: id: a001, owner: Jack, number: 111, postcode: M5A0G4, price: 100]
[Property: id: a003, owner: David, number: 333, postcode: A7D3H1, price: 300]


Please input the index of the action [1, 2, 3, 4]:2
Please input postcode:M5A0G4
test warehouse.selectByPostcode(“M5A0G4”)
result size=1
[Property: id: a001, owner: Jack, number: 111, postcode: M5A0G4, price: 100]


Please input the index of the action [1, 2, 3, 4]:3
Please input property.id:a006
Please input property.owner:Daniel
Please input property.number:900
Please input property.postcode:U7D8E2
Please input property.price:900
test warehouse.store for [Property: id: a006, owner: Daniel, number: 900, postcode: U7D8E2, price: 900]
store ok


Please input the index of the action [1, 2, 3, 4]:4
Please input property.id:a006
test warehouse.delete(“a006″)
delete ok

Test
customer
actions

Start a new terminal, run customer test, There are also two options for
customer test: auto and manual.

➜ python3 customerTest.py

Suds ( https://github.com/cackharot/suds-py3 ) version: 1.3.3.0 IN build: 20170311

Service ( SoapService ) tns=”warehouse.soap”
Prefixes (1)
ns0 = “warehouse.soap”
Ports (1):
(Application)
Methods (2):
selectByPostcode(xs:string postcode, )
selectByPriceRange(xs:integer lowPriceInclusive, xs:integer highPriceInclusive, )
Types (5):
selectByPostcode
selectByPostcodeResponse
selectByPriceRange
selectByPriceRangeResponse
stringArray
——————————————————————————–
Please input the test option [auto, manual]:auto
auto test start
test warehouse.selectByPriceRange(100, 300)
result size=1
(‘string’, [‘[Property: id: a001, owner: Jack, number: 111, postcode: M5A0G4, price: 100]’, ‘[Property: id: a003, owner: David, number: 333, postcode: A7D3H1, price: 300]’])

test warehouse.selectByPostcode(“M5A0G4”)
result size=1
(‘string’, [‘[Property: id: a001, owner: Jack, number: 111, postcode: M5A0G4, price: 100]’])

Please input the test option [auto, manual]:manual
manual test start
Available action:
1: warehouse.selectByPriceRange
2: warehouse.selectByPostcode
Please input the index of the action [1, 2]:1
Please input lowPriceInclusive:100
Please input highPriceInclusive:900
test warehouse.selectByPriceRange(100, 900)
result size=1
(‘string’, [‘[Property: id: a001, owner: Jack, number: 111, postcode: M5A0G4, price: 100]’, ‘[Property: id: a003, owner: David, number: 333, postcode: A7D3H1, price: 300]’])


Please input the index of the action [1, 2]:2
Please input postcode:M5A0G4
test warehouse.selectByPostcode(“M5A0G4”)
result size=1
(‘string’, [‘[Property: id: a001, owner: Jack, number: 111, postcode: M5A0G4, price: 100]’])

Snapshot
for
testing

Posted in Uncategorized

Leave a Reply

Your email address will not be published. Required fields are marked *