From 5002270257331da674995441cf0f4bd674880bb1 Mon Sep 17 00:00:00 2001 From: Peter Nagel Date: Sat, 1 Nov 2014 17:00:50 -0700 Subject: [PATCH] changed examples and tests to use S3 rather than lob.com assets --- README.md | 32 ++++++++++++++++---------------- examples/job.py | 2 +- examples/postcard.py | 4 ++-- tests/test_area.py | 8 ++++---- tests/test_job.py | 2 +- tests/test_object.py | 4 ++-- tests/test_postcard.py | 8 ++++---- 7 files changed, 30 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 32a4571..f1a7f84 100644 --- a/README.md +++ b/README.md @@ -167,7 +167,7 @@ lob.Job.create( }, objects = { 'name': 'Test Object', - 'file': 'https://www.lob.com/test.pdf', + 'file': 'https://s3-us-west-2.amazonaws.com/lob-assets/test.pdf', 'setting_id': '201' } ) @@ -194,11 +194,11 @@ lob.Job.create( }, objects = [{ 'name': 'Test Object 1', - 'file': 'https://www.lob.com/test.pdf', + 'file': 'https://s3-us-west-2.amazonaws.com/lob-assets/test.pdf', 'setting_id': '201' }, { 'name': 'Test Object 2', - 'file': 'https://www.lob.com/test.pdf', + 'file': 'https://s3-us-west-2.amazonaws.com/lob-assets/test.pdf', 'setting_id': '201' }] ) @@ -285,7 +285,7 @@ lob.Object.retrieve() #Create an Object using a URL lob.Object.create( name='Joe Smith', - file='https://www.lob.com/test.pdf', + file='https://s3-us-west-2.amazonaws.com/lob-assets/test.pdf', setting_id='201', quantity=1, double_sided=1 @@ -381,8 +381,8 @@ lob.Postcard.retrieve() lob.Postcard.create( to_address=, from_address=, - front = 'https://www.lob.com/test.pdf', - back = 'https://www.lob.com/test.pdf' + front = 'https://s3-us-west-2.amazonaws.com/lob-assets/test.pdf', + back = 'https://s3-us-west-2.amazonaws.com/lob-assets/test.pdf' ) #Create a Postcard Using Lob Python Objects @@ -392,8 +392,8 @@ from_addr = addresses[1] lob.Postcard.create( to_address = to_addr, from_address = from_addr, - front = 'https://www.lob.com/test.pdf', - back = 'https://www.lob.com/test.pdf' + front = 'https://s3-us-west-2.amazonaws.com/lob-assets/test.pdf', + back = 'https://s3-us-west-2.amazonaws.com/lob-assets/test.pdf' ) #Create Postcard Using Inline Addresses @@ -416,8 +416,8 @@ lob.Postcard.create( 'address_zip': '94107', 'address_country': 'US' }, - front = 'https://www.lob.com/test.pdf', - back = 'https://www.lob.com/test.pdf' + front = 'https://s3-us-west-2.amazonaws.com/lob-assets/test.pdf', + back = 'https://s3-us-west-2.amazonaws.com/lob-assets/test.pdf' ) #Create Postcard Using Inline Addresses and Local File @@ -610,8 +610,8 @@ lob.Area.retrieve() #Basic Area Create with Zip Codes lob.Area.create( name='Lob', - front = 'https://www.lob.com/areafront.pdf', - back = 'https://www.lob.com/areaback.pdf', + front = 'https://s3-us-west-2.amazonaws.com/lob-assets/areafront.pdf', + back = 'https://s3-us-west-2.amazonaws.com/lob-assets/areaback.pdf', routes = ['94158','60031'], target_type = 'all', full_bleed = '1' @@ -621,8 +621,8 @@ lob.Area.create( var routes = lob.Route.list(zip_codes=[94158,60031]) lob.Area.create( name='Lob', - front = 'https://www.lob.com/areafront.pdf', - back = 'https://www.lob.com/areaback.pdf', + front = 'https://s3-us-west-2.amazonaws.com/lob-assets/areafront.pdf', + back = 'https://s3-us-west-2.amazonaws.com/lob-assets/areaback.pdf', routes = routes, target_type = 'all', full_bleed = '1' @@ -630,8 +630,8 @@ lob.Area.create( #Create Area with Optional Parameters lob.Area.create( - front = 'https://www.lob.com/areafront.pdf', - back = 'https://www.lob.com/areaback.pdf', + front = 'https://s3-us-west-2.amazonaws.com/lob-assets/areafront.pdf', + back = 'https://s3-us-west-2.amazonaws.com/lob-assets/areaback.pdf', routes = '94158', ) ``` diff --git a/examples/job.py b/examples/job.py index 34c5ec7..4e0dcc7 100644 --- a/examples/job.py +++ b/examples/job.py @@ -25,7 +25,7 @@ example_object = lob.Object.create( name = 'Example Object', - file = 'https://www.lob.com/test.pdf', + file = 'https://s3-us-west-2.amazonaws.com/lob-assets/test.pdf', setting_id = '201', quantity = 1, double_sided = 1 diff --git a/examples/postcard.py b/examples/postcard.py index c60ac1d..820de76 100644 --- a/examples/postcard.py +++ b/examples/postcard.py @@ -26,8 +26,8 @@ example_postcard = lob.Postcard.create( to_address = example_address, from_address = example_address, - front = 'https://www.lob.com/test.pdf', - back = 'https://www.lob.com/test.pdf' + front = 'https://s3-us-west-2.amazonaws.com/lob-assets/test.pdf', + back = 'https://s3-us-west-2.amazonaws.com/lob-assets/test.pdf' ) print "Postcard Response" diff --git a/tests/test_area.py b/tests/test_area.py index e69661b..18b0ed2 100644 --- a/tests/test_area.py +++ b/tests/test_area.py @@ -11,8 +11,8 @@ def setUp(self): def test_create_area_with_zip(self): area = lob.Area.create( name = 'area_test_zip', - front = 'https://www.lob.com/areafront.pdf', - back = 'https://www.lob.com/areaback.pdf', + front = 'https://s3-us-west-2.amazonaws.com/lob-assets/areafront.pdf', + back = 'https://s3-us-west-2.amazonaws.com/lob-assets/areaback.pdf', routes = ['94158','60031'], target_type = 'all', full_bleed = '1' @@ -23,8 +23,8 @@ def test_create_area_with_zip(self): def test_create_area_with_route(self): area = lob.Area.create( name = 'area_test_route', - front = 'https://www.lob.com/areafront.pdf', - back = 'https://www.lob.com/areaback.pdf', + front = 'https://s3-us-west-2.amazonaws.com/lob-assets/areafront.pdf', + back = 'https://s3-us-west-2.amazonaws.com/lob-assets/areaback.pdf', routes = self.route, target_type = 'all', full_bleed = '1' diff --git a/tests/test_job.py b/tests/test_job.py index 0b1dc9c..4335c3b 100644 --- a/tests/test_job.py +++ b/tests/test_job.py @@ -65,7 +65,7 @@ def test_create_job_inline(self): }, objects = { 'name': 'Object1', - 'file': 'https://www.lob.com/test.pdf', + 'file': 'https://s3-us-west-2.amazonaws.com/lob-assets/test.pdf', 'setting_id': '201' } ) diff --git a/tests/test_object.py b/tests/test_object.py index fa9e69c..2e24bb6 100644 --- a/tests/test_object.py +++ b/tests/test_object.py @@ -25,7 +25,7 @@ def test_list_objects_fail(self): def test_create_object_remote(self): object = lob.Object.create( name = 'Test Object', - file = 'https://www.lob.com/test.pdf', + file = 'https://s3-us-west-2.amazonaws.com/lob-assets/test.pdf', setting_id = 201 ) @@ -52,7 +52,7 @@ def test_create_object_local(self): self.assertTrue(isinstance(object, lob.Object)) self.assertEqual(object.name, 'Test Object Inline') self.assertRaises(AttributeError, lambda: object.nonexistent_key) - + object.name = "something new" self.assertEqual(object.name, "something new") diff --git a/tests/test_postcard.py b/tests/test_postcard.py index 35e973f..85f46dd 100644 --- a/tests/test_postcard.py +++ b/tests/test_postcard.py @@ -25,8 +25,8 @@ def test_create_postcard(self): postcard = lob.Postcard.create( to_address = self.addr.id, from_address = self.addr.id, - front = 'https://www.lob.com/test.pdf', - back = 'https://www.lob.com/test.pdf' + front = 'https://s3-us-west-2.amazonaws.com/lob-assets/test.pdf', + back = 'https://s3-us-west-2.amazonaws.com/lob-assets/test.pdf' ) self.assertEqual(postcard.to_address.id, self.addr.id) self.assertEqual(postcard.from_address.id, self.addr.id) @@ -37,8 +37,8 @@ def test_create_postcard_lob_obj(self): postcard = lob.Postcard.create( to_address = self.addr, from_address = self.addr, - front = 'https://www.lob.com/test.pdf', - back = 'https://www.lob.com/test.pdf' + front = 'https://s3-us-west-2.amazonaws.com/lob-assets/test.pdf', + back = 'https://s3-us-west-2.amazonaws.com/lob-assets/test.pdf' ) self.assertEqual(postcard.to_address.id, self.addr.id) self.assertEqual(postcard.from_address.id, self.addr.id)