Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_pickup_batch(noon_on_next_monday):
# Create a Batch containing multiple Shipments. Then we try to buy a Pickup and assert if it was bought.
pickup_address = easypost.Address.create(
verify=['delivery'],
name='Jarrett Streebin',
company='EasyPost',
street1='1 MONTGOMERY ST STE 400',
city='San Francisco',
state='CA',
zip='94104',
phone='415-456-7890'
)
shipments = [
{
'to_address': {
'name': 'Customer',
'street1': '8308 Fenway Rd',
'city': 'Bethesda',
def test_address_creation_verification():
# Create an address and then verify some fields to test whether it was created just fine.
address = easypost.Address.create(
company='EasyPost',
street1='118 2nd St',
street2='4th Fl',
city='San Francisco',
state='CA',
zip='94105',
phone='415-456-7890'
)
address.verify()
address = easypost.Address.retrieve(address.id)
assert address.country == 'US'
assert address.email is None
assert address.federal_tax_id is None
assert address.state == 'CA'
def test_address_bytestring():
# Create an address with a bytestring field and assert if it was created correctly.
state = u'DELEGACI\xf3N BENITO JU\xe1REZ'
address = easypost.Address.create(state=state.encode('utf-8'))
assert address.state == state
def test_single_pickup(noon_on_next_monday):
"""Create a Shipment, buy it, and then buy a pickup for it"""
pickup_address = easypost.Address.create(
verify=['delivery'],
name='Jarrett Streebin',
company='EasyPost',
street1='1 MONTGOMERY ST STE 400',
city='San Francisco',
state='CA',
zip='94104',
phone='415-456-7890'
)
shipment = easypost.Shipment.create(
to_address={
'name': 'Customer',
'street1': '8308 Fenway Rd',
'city': 'Bethesda',
'state': 'MD',
from time import sleep
import easypost
easypost.api_key = 'cueqNZUb3ldeWTNX7MU3Mel8UXtaAMUi'
# easypost.api_base = 'http://localhost:5000/v2'
# from address and parcel don't change
from_address = easypost.Address.create(
name="Simpler Postage Inc.",
street1="388 Townsend St",
street2="Apt 20",
city="San Francisco",
state="CA",
zip="94107",
phone="415-456-7890"
)
parcel = easypost.Parcel.create(
predefined_package="RegionalRateBoxA",
weight=64
)
# # populate order_list from db, csv, etc.
order_list = [{