Ejemplo n.º 1
0
    def setUpClass(cls):
        requests.delete(urls.TEST_ITEM_SCHEMA_URL)
        schema = {
            '$schema': 'http://json-schema.org/draft-03/schema#',
            'collectionName': urls.TEST_COLLECTION_NAME,
            'properties': {
                'name': {'type': 'string'}
            },
            'type': 'object'
        }

        requests.post(
            urls.collection_url('item-schemas'),
            data=json.dumps(schema),
            headers={
                'content-type': 'application/json'
            })
        data = {'name': 'POST Alice'}
        cls.response = requests.post(
            urls.TEST_COLLECTION_URL,
            data=json.dumps(data),
            headers={
                'content-type': 'application/json'
            })

        cls.json_response = cls.response.json()
Ejemplo n.º 2
0
    def setUpClass(cls):
        data = {'name': 'PUT Alice', }
        put_data = {'age': 30}
        requests.delete(urls.TEST_ITEM_SCHEMA_URL)
        schema = {
            '$schema': 'http://json-schema.org/draft-03/schema#',
            'collectionName': urls.TEST_COLLECTION_NAME,
            'properties': {
                'name': {'type': 'string'}
            },
            'type': 'object'
        }

        requests.post(
            urls.collection_url('item-schemas'),
            data=json.dumps(schema),
            headers={
                'content-type': 'application/json'
            })
        cls.before_item = requests.post(
            urls.TEST_COLLECTION_URL,
            data=json.dumps(data),
            headers={
                'content-type': 'application/json'
            }).json()

        sleep(1)

        cls.response = requests.put(
            urls.test_resource_url(cls.before_item['id']),
            data=json.dumps(put_data),
            headers={
                'content-type': 'application/json'
            })
        cls.json_response = cls.response.json()
Ejemplo n.º 3
0
    def setUpClass(cls):
        data = {
            'name': 'PUT Alice',
        }
        put_data = {'age': 30}
        requests.delete(urls.TEST_ITEM_SCHEMA_URL)
        schema = {
            '$schema': 'http://json-schema.org/draft-03/schema#',
            'collectionName': urls.TEST_COLLECTION_NAME,
            'properties': {
                'name': {
                    'type': 'string'
                }
            },
            'type': 'object'
        }

        requests.post(urls.collection_url('item-schemas'),
                      data=json.dumps(schema),
                      headers={'content-type': 'application/json'})
        cls.before_item = requests.post(urls.TEST_COLLECTION_URL,
                                        data=json.dumps(data),
                                        headers={
                                            'content-type': 'application/json'
                                        }).json()

        sleep(1)

        cls.response = requests.put(
            urls.test_resource_url(cls.before_item['id']),
            data=json.dumps(put_data),
            headers={'content-type': 'application/json'})
        cls.json_response = cls.response.json()
Ejemplo n.º 4
0
 def setUpClass(cls):
     data = '..A..B..'
     cls.response = requests.post(
         urls.collection_url('item-schemas'),
         data=data,
         headers={
             'content-type': 'application/json'
         })
Ejemplo n.º 5
0
    def setUpClass(cls):
        data = {
            '$schema': 'http://json-schema.org/draft-03/hyper-schema#',
            'collectionName': urls.TEST_COLLECTION_NAME
        }
        cls.response = requests.post(
            urls.collection_url('item-schemas'),
            data=json.dumps(data),
            headers={
                'content-type': 'application/json'
            })

        cls.schema = cls.response.json()
Ejemplo n.º 6
0
    def setUpClass(cls):
        schema = {
            '$schema': 'http://json-schema.org/draft-03/schema#',
            'collectionName': urls.TEST_COLLECTION_NAME
        }
        requests.post(urls.collection_url('item-schemas'),
                      data=json.dumps(schema),
                      headers={'content-type': 'application/json'})

        data = {'name': 'GET Alice'}
        item = requests.post(urls.TEST_COLLECTION_URL,
                             data=json.dumps(data),
                             headers={
                                 'content-type': 'application/json'
                             }).json()

        cls.response = requests.get(urls.test_resource_url(item['id']))
        cls.json_response = cls.response.json()
Ejemplo n.º 7
0
    def setUpClass(cls):
        schema = {
            '$schema': 'http://json-schema.org/draft-03/schema#',
            'collectionName': urls.TEST_COLLECTION_NAME
        }
        requests.post(
            urls.collection_url('item-schemas'),
            data=json.dumps(schema),
            headers={
                'content-type': 'application/json'
            })

        data = {'name': 'GET Alice'}
        item = requests.post(
            urls.TEST_COLLECTION_URL,
            data=json.dumps(data),
            headers={
                'content-type': 'application/json'
            }).json()

        cls.response = requests.get(urls.test_resource_url(item['id']))
        cls.json_response = cls.response.json()
Ejemplo n.º 8
0
    def setUpClass(cls):
        schema = {
            '$schema': 'http://json-schema.org/draft-03/schema#',
            'collectionName': urls.TEST_COLLECTION_NAME
        }
        requests.post(urls.collection_url('item-schemas'),
                      data=json.dumps(schema),
                      headers={'content-type': 'application/json'})

        data = {'name': 'Alice (Get Collection)'}
        requests.post(urls.TEST_COLLECTION_URL,
                      data=json.dumps(data),
                      headers={'content-type': 'application/json'})

        data = {'name': 'Bob (Get Collection)'}
        requests.post(urls.TEST_COLLECTION_URL,
                      data=json.dumps(data),
                      headers={'content-type': 'application/json'})

        cls.response = requests.get(urls.TEST_COLLECTION_URL +
                                    '?filter[perPage]=1000&filter[order]=name')

        cls.json_response = cls.response.json()
Ejemplo n.º 9
0
    def setUpClass(cls):
        requests.delete(urls.TEST_ITEM_SCHEMA_URL)
        schema = {
            '$schema': 'http://json-schema.org/draft-03/schema#',
            'collectionName': urls.TEST_COLLECTION_NAME,
            'properties': {
                'name': {
                    'type': 'string'
                }
            },
            'type': 'object'
        }

        requests.post(urls.collection_url('item-schemas'),
                      data=json.dumps(schema),
                      headers={'content-type': 'application/json'})
        data = {'name': 'POST Alice'}
        cls.response = requests.post(
            urls.TEST_COLLECTION_URL,
            data=json.dumps(data),
            headers={'content-type': 'application/json'})

        cls.json_response = cls.response.json()
Ejemplo n.º 10
0
 def setUpClass(cls):
     cls.response = requests.get(urls.collection_url('test-people-404'))