def test_get_and_parses_api_doc_info(self, _get_api_doc):
        """Get and parse api doc information and returns a list of resources"""
        _get_api_doc.return_value = MOCK_API_DOC

        info = inspect.get_resource_create_info()

        _get_api_doc.assert_called_once_with()
        self.assertEqual(info, RESULT_FOR_MOCK_API_DOC)
    def test_get_and_parses_api_doc_info(self, _get_api_doc):
        """Get and parse api doc information and returns a list of resources"""
        _get_api_doc.return_value = MOCK_API_DOC

        info = inspect.get_resource_create_info()

        _get_api_doc.assert_called_once_with()
        self.assertEqual(info, RESULT_FOR_MOCK_API_DOC)
    def test_calls_get_api_doc(self, _get_api_doc):
        """Call ``get_api_doc`` if no ``api_doc`` is provided"""
        _get_api_doc.return_value = {
            'resources': {},
        }

        info = inspect.get_resource_create_info()

        _get_api_doc.assert_called_once()
        self.assertEqual(info, {})
    def test_calls_get_api_doc(self, _get_api_doc):
        """Call ``get_api_doc`` if no ``api_doc`` is provided"""
        _get_api_doc.return_value = {
            'resources': {},
        }

        info = inspect.get_resource_create_info()

        _get_api_doc.assert_called_once()
        self.assertEqual(info, {})
Exemple #5
0
def main():
    """Inpects the API create info and output the generated entities classes"""
    create_info = inspect.get_resource_create_info()
    resource_names = sorted(create_info)
    entities_classes = []

    for resource_name in resource_names:
        resource = create_info[resource_name]
        entities_classes.append(
            str(
                EntityClass(
                    resource_name,
                    _get_fields(resource['params']),
                    meta=_get_meta(resource),
                )))

    print '\n\n'.join(entities_classes),
def main():
    """Inpects the API create info and output the generated entities classes"""
    create_info = inspect.get_resource_create_info()
    resource_names = sorted(create_info)
    entities_classes = []

    for resource_name in resource_names:
        resource = create_info[resource_name]
        entities_classes.append(str(
            EntityClass(
                resource_name,
                _get_fields(resource['params']),
                meta=_get_meta(resource),
            )
        ))

    print '\n\n'.join(entities_classes),
    def test_parses_api_doc_info(self):
        """Parse api doc information and returns a list of resources"""
        info = inspect.get_resource_create_info(MOCK_API_DOC)

        self.assertEqual(info, RESULT_FOR_MOCK_API_DOC)
    def test_parses_api_doc_info(self):
        """Parse api doc information and returns a list of resources"""
        info = inspect.get_resource_create_info(MOCK_API_DOC)

        self.assertEqual(info, RESULT_FOR_MOCK_API_DOC)