def setUp(self): """Create test objects.""" self.arnold = {'id': 1, 'name': 'Arnold Ziffel'} self.eb = {'id': 2, 'name': 'Eb Dawson'} self.sam = {'id': 3, 'name': 'Sam Drucker'} self.soup = {'id': 1, 'name': 'Hot Water Soup'} self.store_new = {'name': 'General Store'} self.general_store = {'id': 1, 'name': 'General Store'} self.store_update = {'manager_id': 3, 'id': 1, 'name': 'General Store'} self.xml_headers = {'Content-type': 'application/xml'} self.json_headers = {'Content-type': 'application/json'} self.matz = util.to_json({ 'id': 1, 'name': 'Matz' }, root='person').encode('utf-8') self.matz_deep = util.to_json( { 'id': 1, 'name': 'Matz', 'other': 'other' }, root='person').encode('utf-8') self.matz_array = util.to_json([{ 'id': 1, 'name': 'Matz' }], root='people').encode('utf-8') self.ryan = util.to_json({'name': 'Ryan'}, root='person') self.addy = util.to_json({ 'id': 1, 'street': '12345 Street' }, root='address') self.addy_deep = util.to_json( { 'id': 1, 'street': '12345 Street', 'zip': "27519" }, root='address') http_fake.initialize() # Fake all http requests self.http = http_fake.TestHandler self.http.set_response(Error('Bad request')) self.http.site = 'http://localhost' self.zero_length_content_headers = { 'Content-length': '0', 'Content-type': 'application/json' } class Person(activeresource.ActiveResource): _site = 'http://localhost' self.person = Person self.store = Store self.address = Address
def setUp(self): ActiveResource.site = None ActiveResource.headers = None shopify.ShopifyResource.clear_session() shopify.ShopifyResource.site = "https://this-is-my-test-show.myshopify.com/admin/api/unstable" shopify.ShopifyResource.password = None shopify.ShopifyResource.user = None http_fake.initialize() self.http = http_fake.TestHandler self.http.set_response(Exception("Bad request")) self.http.site = "https://this-is-my-test-show.myshopify.com"
def setUp(self): ActiveResource.site = None ActiveResource.headers = None haravan.HaravanResource.clear_session() haravan.HaravanResource.site = "https://this-is-my-test-show.myharavan.com/admin" haravan.HaravanResource.password = None haravan.HaravanResource.user = None http_fake.initialize() self.http = http_fake.TestHandler self.http.set_response(Exception('Bad request')) self.http.site = 'https://this-is-my-test-show.myharavan.com'
def setUp(self): ActiveResource.site = None ActiveResource.headers=None haravan.HaravanResource.clear_session() haravan.HaravanResource.site = "https://this-is-my-test-show.myharavan.com/admin" haravan.HaravanResource.password = None haravan.HaravanResource.user = None http_fake.initialize() self.http = http_fake.TestHandler self.http.set_response(Exception('Bad request')) self.http.site = 'https://this-is-my-test-show.myharavan.com'
def setUp(self): ActiveResource.site = None ActiveResource.headers=None shopify.ShopifyResource.clear_session() shopify.ShopifyResource.site = "http://localhost/admin" shopify.ShopifyResource.password = None shopify.ShopifyResource.user = None http_fake.initialize() self.http = http_fake.TestHandler self.http.set_response(Exception('Bad request')) self.http.site = 'https://localhost'
def setUp(self): ActiveResource.site = None ActiveResource.headers = None shopify.ShopifyResource.clear_session() shopify.ShopifyResource.site = "https://this-is-my-test-show.myshopify.com/admin/api/unstable" shopify.ShopifyResource.password = None shopify.ShopifyResource.user = None http_fake.initialize() self.http = http_fake.TestHandler self.http.set_response(Exception('Bad request')) self.http.site = 'https://this-is-my-test-show.myshopify.com' self.fake('apis', url='https://app.shopify.com/services/apis.json', method='GET', code=200, response_headers={'Content-type': 'application/json'}, body=self.load_fixture('api_version'), has_user_agent=False)
def setUp(self): """Create test objects.""" self.arnold = {'id': 1, 'name': 'Arnold Ziffel'} self.eb = {'id': 2, 'name': 'Eb Dawson'} self.sam = {'id': 3, 'name': 'Sam Drucker'} self.soup = {'id': 1, 'name': 'Hot Water Soup'} self.store_new = {'name': 'General Store'} self.general_store = {'id': 1, 'name': 'General Store'} self.store_update = {'manager_id': 3, 'id': 1, 'name':'General Store'} self.xml_headers = {'Content-type': 'application/xml'} self.json_headers = {'Content-type': 'application/json'} self.matz = util.to_json( {'id': 1, 'name': 'Matz'}, root='person') self.matz_deep = util.to_json( {'id': 1, 'name': 'Matz', 'other': 'other'}, root='person') self.matz_array = util.to_json( [{'id': 1, 'name': 'Matz'}], root='people') self.ryan = util.to_json( {'name': 'Ryan'}, root='person') self.addy = util.to_json( {'id': 1, 'street': '12345 Street'}, root='address') self.addy_deep = util.to_json( {'id': 1, 'street': '12345 Street', 'zip': "27519" }, root='address') http_fake.initialize() # Fake all http requests self.http = http_fake.TestHandler self.http.set_response(Error('Bad request')) self.http.site = 'http://localhost' self.zero_length_content_headers = {'Content-length': '0', 'Content-type': 'application/json'} class Person(activeresource.ActiveResource): _site = 'http://localhost' self.person = Person self.store = Store self.address = Address
def setUp(self): '''Create test objects.''' matz = {'id': 1, 'name': 'Matz'} david = {'id': 2, 'name': 'David'} self.matz = util.to_json(matz, root='person') self.david = util.to_json(david, root='person') self.people = util.to_json([matz, david], root='people') self.people_single = util.to_json( [matz], root='people-single-elements') self.people_empty = util.to_json([], root='people-empty-elements') http_fake.initialize() self.http = http_fake.TestHandler self.http.site = 'http://localhost' self.http.set_response(Error('Bad request')) self.zero_length_content_headers = {'Content-Length': '0', 'Content-Type': 'application/json'} self.header = {'Key': 'value'} self.connection = connection.Connection(self.http.site)
def setUp(self): '''Create test objects.''' matz = {'id': 1, 'name': 'Matz'} david = {'id': 2, 'name': 'David'} self.matz = util.to_json(matz, root='person') self.david = util.to_json(david, root='person') self.people = util.to_json([matz, david], root='people') self.people_single = util.to_json([matz], root='people-single-elements') self.people_empty = util.to_json([], root='people-empty-elements') http_fake.initialize() self.http = http_fake.TestHandler self.http.site = 'http://localhost' self.http.set_response(Error('Bad request')) self.zero_length_content_headers = { 'Content-Length': '0', 'Content-Type': 'application/json' } self.header = {'Key': 'value'} self.connection = connection.Connection(self.http.site)