コード例 #1
0
 def test_add_cell_does_not_add_non_api_cell_to_spec(self):
     """Builder should store ignore non- API cells."""
     builder = SwaggerSpecBuilder('some_spec')
     builder.add_cell('regular code cell')
     result = builder.build()
     self.assertEqual(len(result['paths']), 0,
                      'Title was not set to new value')
コード例 #2
0
 def test_add_title_adds_title_to_spec(self):
     """Builder should store an API title."""
     expected = 'Some New Title'
     builder = SwaggerSpecBuilder('some_spec')
     builder.set_title(expected)
     result = builder.build()
     self.assertEqual(result['info']['title'] ,expected,'Title was not set to new value')
コード例 #3
0
 def test_add_cell_adds_api_cell_to_spec(self):
     """Builder should store an API cell annotation."""
     expected = {'get': {'responses': {200: {'description': 'Success'}}}}
     builder = SwaggerSpecBuilder('some_spec')
     builder.add_cell('# GET /some/resource')
     result = builder.build()
     self.assertEqual(result['paths']['/some/resource'], expected,
                      'Title was not set to new value')
コード例 #4
0
 def test_add_title_adds_title_to_spec(self):
     """Builder should store an API title."""
     expected = 'Some New Title'
     builder = SwaggerSpecBuilder('some_spec')
     builder.set_title(expected)
     result = builder.build()
     self.assertEqual(result['info']['title'], expected,
                      'Title was not set to new value')
コード例 #5
0
 def test_add_cell_adds_api_cell_to_spec(self):
     """Builder should store an API cell annotation."""
     expected = {
         'get' : {
             'responses' : {
                 200 : { 'description': 'Success'}
             }
         }
     }
     builder = SwaggerSpecBuilder('some_spec')
     builder.add_cell('# GET /some/resource')
     result = builder.build()
     self.assertEqual(result['paths']['/some/resource'] ,expected,'Title was not set to new value')
コード例 #6
0
 def test_add_cell_does_not_add_non_api_cell_to_spec(self):
     """Builder should store ignore non- API cells."""
     builder = SwaggerSpecBuilder('some_spec')
     builder.add_cell('regular code cell')
     result = builder.build()
     self.assertEqual(len(result['paths']) , 0,'Title was not set to new value')