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.matz = util.to_xml({'id': 1, 'name': 'Matz'}, root='person')
        self.matz_deep = util.to_xml(
            {
                'id': 1,
                'name': 'Matz',
                'other': 'other'
            }, root='person')
        self.matz_array = util.to_xml([{
            'id': 1,
            'name': 'Matz'
        }],
                                      root='people')
        self.ryan = util.to_xml({'name': 'Ryan'}, root='person')
        self.addy = util.to_xml({
            'id': 1,
            'street': '12345 Street'
        },
                                root='address')
        self.addy_deep = util.to_xml(
            {
                '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/xml'
        }

        class Person(activeresource.ActiveResource):
            _site = 'http://localhost'

        self.person = Person

        class Store(activeresource.ActiveResource):
            _site = 'http://localhost'

        self.store = Store

        class Address(activeresource.ActiveResource):
            _site = 'http://localhost/people/$person_id/'

        self.address = Address
Exemple #2
0
    def setUp(self):
        '''Create test objects.'''
        matz = {'id': 1, 'name': 'Matz'}
        david = {'id': 2, 'name': 'David'}
        self.matz = util.to_xml(matz, root='person')
        self.david = util.to_xml(david, root='person')
        self.people = util.to_xml([matz, david], root='people')
        self.people_single = util.to_xml([matz], root='people-single-elements')
        self.people_empty = util.to_xml([], 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.header = {'Key': 'value'}
        self.connection = connection.Connection(self.http.site)
    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.matz  = util.to_xml(
                {'id': 1, 'name': 'Matz'}, root='person')
        self.matz_deep  = util.to_xml(
                {'id': 1, 'name': 'Matz', 'other': 'other'},
                root='person')
        self.matz_array = util.to_xml(
                [{'id': 1, 'name': 'Matz'}], root='people')
        self.ryan = util.to_xml(
                {'name': 'Ryan'}, root='person')
        self.addy = util.to_xml(
                {'id': 1, 'street': '12345 Street'},
                root='address')
        self.addy_deep  = util.to_xml(
                {'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/xml'}

        class Person(activeresource.ActiveResource):
            _site = 'http://localhost'
        self.person = Person

        class Store(activeresource.ActiveResource):
            _site = 'http://localhost'
        self.store = Store

        class Address(activeresource.ActiveResource):
            _site = 'http://localhost/people/$person_id/'
        self.address = Address
    def setUp(self):
        """Create test objects."""
        matz = {"id": 1, "name": "Matz"}
        david = {"id": 2, "name": "David"}
        self.matz = util.to_xml(matz, root="person")
        self.david = util.to_xml(david, root="person")
        self.people = util.to_xml([matz, david], root="people")
        self.people_single = util.to_xml([matz], root="people-single-elements")
        self.people_empty = util.to_xml([], 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/xml"}

        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_xml(matz, root='person')
        self.david = util.to_xml(david, root='person')
        self.people = util.to_xml([matz, david], root='people')
        self.people_single = util.to_xml(
            [matz], root='people-single-elements')
        self.people_empty = util.to_xml([], 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/xml'}

        self.header = {'Key': 'value'}
        self.connection = connection.Connection(self.http.site)
Exemple #6
0
    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.matz = util.to_xml({"id": 1, "name": "Matz"}, root="person")
        self.matz_deep = util.to_xml({"id": 1, "name": "Matz", "other": "other"}, root="person")
        self.matz_array = util.to_xml([{"id": 1, "name": "Matz"}], root="people")
        self.ryan = util.to_xml({"name": "Ryan"}, root="person")
        self.addy = util.to_xml({"id": 1, "street": "12345 Street"}, root="address")
        self.addy_deep = util.to_xml({"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/xml"}

        class Person(activeresource.ActiveResource):
            _site = "http://localhost"

        self.person = Person

        class Store(activeresource.ActiveResource):
            _site = "http://localhost"

        self.store = Store

        class Address(activeresource.ActiveResource):
            _site = "http://localhost/people/$person_id/"

        self.address = Address