-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#8] Add tests for documentation management commands
- Loading branch information
Showing
14 changed files
with
335 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,28 @@ | ||
from django.contrib import postgres | ||
from django.db import models | ||
|
||
|
||
class BasicFieldDescription(models.TextChoices): | ||
""" | ||
Description of the values for basic Django model fields | ||
""" | ||
|
||
ArrayField = "string, comma-delimited ('foo,bar,baz')" | ||
BooleanField = "True, False" | ||
CharField = "string" | ||
FileField = ( | ||
basic_field_description = { | ||
postgres.fields.ArrayField: "string, comma-delimited ('foo,bar,baz')", | ||
models.BooleanField: "True, False", | ||
models.CharField: "string", | ||
models.FileField: ( | ||
"string represeting the (absolute) path to a file, " | ||
"including file extension: {example}".format( | ||
example="/absolute/path/to/file.xml" | ||
) | ||
) | ||
ImageField = ( | ||
), | ||
models.ImageField: ( | ||
"string represeting the (absolute) path to an image file, " | ||
"including file extension: {example}".format( | ||
example="/absolute/path/to/image.png" | ||
) | ||
) | ||
IntegerField = "string representing an integer" | ||
JSONField = "Mapping: {example}".format(example="{'some_key': 'Some value'}") | ||
PositiveIntegerField = "string representing a positive integer" | ||
TextField = "text (string)" | ||
URLField = "string (URL)" | ||
UUIDField = "UUID string {example}".format( | ||
), | ||
models.IntegerField: "string representing an integer", | ||
models.JSONField: "Mapping: {example}".format(example="{'some_key': 'Some value'}"), | ||
models.PositiveIntegerField: "string representing a positive integer", | ||
models.TextField: "text (string)", | ||
models.URLField: "string (URL)", | ||
models.UUIDField: "UUID string {example}".format( | ||
example="(e.g. f6b45142-0c60-4ec7-b43d-28ceacdc0b34)" | ||
) | ||
), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
.. _product: | ||
|
||
===================== | ||
Product Configuration | ||
===================== | ||
|
||
Settings Overview | ||
================= | ||
|
||
Enable/Disable configuration: | ||
""""""""""""""""""""""""""""" | ||
|
||
:: | ||
|
||
PRODUCT_CONFIG_ENABLE | ||
|
||
Required: | ||
""""""""" | ||
|
||
:: | ||
|
||
PRODUCT_NAME | ||
PRODUCT_SERVICE_URL | ||
|
||
All settings: | ||
""""""""""""" | ||
|
||
:: | ||
|
||
PRODUCT_NAME | ||
PRODUCT_SERVICE_URL | ||
PRODUCT_TAGS | ||
|
||
Detailed Information | ||
==================== | ||
|
||
:: | ||
|
||
Variable PRODUCT_NAME | ||
Setting Name | ||
Description The name of the product | ||
Possible values string | ||
Default value No default | ||
Variable PRODUCT_SERVICE_URL | ||
Setting Service url | ||
Description The url of the service | ||
Possible values string (URL) | ||
Default value No default | ||
Variable PRODUCT_TAGS | ||
Setting tags | ||
Description Tags for the product | ||
Possible values string, comma-delimited ('foo,bar,baz') | ||
Default value example_tag |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from django.contrib.postgres.fields import ArrayField | ||
from django.db import models | ||
|
||
|
||
class Service(models.Model): | ||
url = models.URLField( | ||
verbose_name="Service url", | ||
help_text="The url of the service", | ||
) | ||
bogus = models.CharField( | ||
verbose_name="Bogus service field", help_text="Should not be included in docs" | ||
) | ||
|
||
|
||
class ProductConfig(models.Model): | ||
name = models.CharField( | ||
verbose_name="Name", | ||
help_text="The name of the product", | ||
) | ||
service = models.OneToOneField( | ||
to=Service, | ||
verbose_name="Service", | ||
default=None, | ||
on_delete=models.SET_NULL, | ||
help_text="API service of the product", | ||
) | ||
tags = ArrayField( | ||
base_field=models.CharField("Product tag"), | ||
default=["example_tag"], | ||
help_text="Tags for the product", | ||
) | ||
bogus = models.CharField( | ||
help_text="Should be excluded", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{% block link %}{{ link }}{% endblock %} | ||
|
||
{% block title %}{{ title }}{% endblock %} | ||
|
||
Settings Overview | ||
================= | ||
|
||
Enable/Disable configuration: | ||
""""""""""""""""""""""""""""" | ||
|
||
:: | ||
|
||
{% spaceless %} | ||
{{ enable_settings }} | ||
{% endspaceless %} | ||
|
||
Required: | ||
""""""""" | ||
|
||
:: | ||
|
||
{% spaceless %} | ||
{% for setting in required_settings %}{{ setting }} | ||
{% endfor %} | ||
{% endspaceless %} | ||
|
||
All settings: | ||
""""""""""""" | ||
|
||
:: | ||
|
||
{% spaceless %} | ||
{% for setting in all_settings %}{{ setting }} | ||
{% endfor %} | ||
{% endspaceless %} | ||
|
||
Detailed Information | ||
==================== | ||
|
||
:: | ||
|
||
{% spaceless %} | ||
{% for detail in detailed_info %} | ||
{% for part in detail %}{{ part|safe }} | ||
{% endfor %}{% endfor %} | ||
{% endspaceless %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
mock_product_doc = ( | ||
'.. _product:\n\n=====================\nProduct Configuration\n=====================\n\nSettings Overview\n=================\n\nEnable/Disable configuration:\n"""""""""""""""""""""""""""""\n\n::\n\n PRODUCT_CONFIG_ENABLE\n\nRequired:\n"""""""""\n\n::\n\n PRODUCT_NAME\n PRODUCT_SERVICE_URL\n\nAll settings:\n"""""""""""""\n\n::\n\n PRODUCT_NAME\n PRODUCT_SERVICE_URL\n PRODUCT_TAGS\n\nDetailed Information\n====================\n\n::\n\n Variable PRODUCT_NAME\n Setting Name\n Description The name of the product\n Possible values string\n Default value No default\n \n Variable PRODUCT_SERVICE_URL\n Setting Service url\n Description The url of the service\n Possible values string (URL)\n Default value No default\n \n Variable PRODUCT_TAGS\n Setting tags\n Description Tags for the product\n Possible values string, comma-delimited (\'foo,bar,baz\')\n Default value example_tag\n' | ||
) |
Oops, something went wrong.