Exemple #1
0
 def test_mocking(self):
     content = {
         'test': {
             'post_data': Link(url='/post_data/', action='post', fields=[
                 Field('data', location='body')
             ]),
         }
     }
     schema = Document(title='test', content=content)
     mock.add(schema, ['test', 'post_data'], {"a": 1})
     client = DjangoCoreAPIClient()
     doc = client.action(schema, ['test', 'post_data'], params={'data': {
         'test': 'cat'
     }})
     self.assertEqual(doc, {"a": 1})
Exemple #2
0
    def test_post_data(self):
        content = {
            'test': {
                'post_data': Link(url='/post_data/', action='post', fields=[
                    Field('data', location='body')
                ]),
            }
        }
        schema = Document(title='test', content=content)

        client = DjangoCoreAPIClient()
        doc = client.action(schema, ['test', 'post_data'], params={'data': {
            'test': 'cat'
        }})
        self.assertIsNotNone(doc)
Exemple #3
0
 def test_mocking(self):
     content = {
         'test': {
             'post_data':
             Link(url='/post_data/',
                  action='post',
                  fields=[Field('data', location='body')]),
         }
     }
     schema = Document(title='test', content=content)
     mock.add(schema, ['test', 'post_data'], {"a": 1})
     client = DjangoCoreAPIClient()
     doc = client.action(schema, ['test', 'post_data'],
                         params={'data': {
                             'test': 'cat'
                         }})
     self.assertEqual(doc, {"a": 1})
Exemple #4
0
    def test_post_data(self):
        content = {
            'test': {
                'post_data':
                Link(url='/post_data/',
                     action='post',
                     fields=[Field('data', location='body')]),
            }
        }
        schema = Document(title='test', content=content)

        client = DjangoCoreAPIClient()
        doc = client.action(schema, ['test', 'post_data'],
                            params={'data': {
                                'test': 'cat'
                            }})
        self.assertIsNotNone(doc)
 def test_client_headers(self):
     transport = DjangoTestHTTPTransport(headers={'authorization': 'token'})
     client = DjangoCoreAPIClient(transports=[transport])
     doc = client.get('/headers/')
     self.assertIsNotNone(doc)
 def test_client(self):
     client = DjangoCoreAPIClient()
     doc = client.get('/')
     self.assertIsNotNone(doc)
Exemple #7
0
 def test_client_headers(self):
     transport = DjangoTestHTTPTransport(headers={'authorization': 'token'})
     client = DjangoCoreAPIClient(transports=[transport])
     doc = client.get('/headers/')
     self.assertIsNotNone(doc)
Exemple #8
0
 def test_client(self):
     client = DjangoCoreAPIClient()
     doc = client.get('/')
     self.assertIsNotNone(doc)