Merge branch 'main' into readme_update

This commit is contained in:
Tino Schreiber 2023-05-12 07:15:44 +00:00
commit 0c93fa1e4a
10 changed files with 406 additions and 14 deletions

File diff suppressed because it is too large Load Diff

View File

@ -18,7 +18,10 @@ import os
import sys import sys
extensions = [ extensions = [
'otcdocstheme' 'otcdocstheme',
{%- if otc_sbv %}
'otc_sphinx_directives'
{%- endif %}
] ]
otcdocs_auto_name = False otcdocs_auto_name = False

View File

@ -2,3 +2,6 @@ sphinx>=2.0.0,!=2.1.0 # BSD
otcdocstheme # Apache-2.0 otcdocstheme # Apache-2.0
# releasenotes # releasenotes
reno>=3.1.0 # Apache-2.0 reno>=3.1.0 # Apache-2.0
otc-sphinx-directives>=0.1.0
git+https://gitea.eco.tsi-dev.otc-service.com/infra/otc-metadata.git#egg=otc_metadata

View File

@ -0,0 +1,7 @@
{{ sbv_title }}
.. directive_wrapper::
:class: container-sbv
.. service_card::
:service_type: {{ service_type }}

View File

@ -29,7 +29,11 @@ allowlist_externals =
mkdir mkdir
cp cp
sh sh
rm
sphinx-build
commands = commands =
rm -rf doc/build/html doc/build/doctrees
sphinx-build -a -E -W -d doc/build/doctrees -b html doc/source doc/build/html
{%- for doc in docs %} {%- for doc in docs %}
{[testenv:{{ doc.type }}]commands} {[testenv:{{ doc.type }}]commands}
{[testenv:json-{{ doc.type }}]commands} {[testenv:json-{{ doc.type }}]commands}
@ -115,3 +119,7 @@ commands =
cp {{ loc }}/build/pdf/{{ doc.pdf_name }}.pdf doc/build/pdf/ cp {{ loc }}/build/pdf/{{ doc.pdf_name }}.pdf doc/build/pdf/
{% endif %} {% endif %}
{% endfor %} {% endfor %}
[doc8]
ignore = D001
extensions = .rst, .yaml

View File

@ -21,8 +21,45 @@ Tests for `otc-metadata` module.
from unittest import TestCase from unittest import TestCase
from otc_metadata import services
class TestOtcMetadata(TestCase): class TestOtcMetadata(TestCase):
def setUp(self):
self.data = services.Services()
def test_something(self): def test_data_is_sorted(self):
pass curr = self.data
new = services.Services()
new._sort_data()
self.assertEqual(
curr._service_data, new._service_data, "Data is sorted properly"
)
def test_service_categories(self):
category = dict()
for cat in self.data._service_data["service_categories"]:
category[cat["name"]] = cat["title"]
for srv in self.data.all_services:
self.assertTrue(
srv["service_category"] in category,
f"Category {srv['service_category']} is present",
)
def test_doc_contains_required_data(self):
srv_types = dict()
for srv in self.data.all_services:
srv_types[srv["service_type"]] = srv
for doc in self.data.all_docs:
for attr in [
"rst_location",
"service_type",
"title",
"type",
]:
self.assertIn(attr, doc, f"Document {doc} contains {attr}")
self.assertIn(
doc["service_type"],
srv_types,
f"Document {doc} contains valid service_type",
)

View File

@ -3,3 +3,4 @@ ruamel.yaml
requests requests
jinja2 jinja2
dirsync dirsync
cookiecutter

File diff suppressed because it is too large Load Diff

View File

@ -19,7 +19,6 @@ commands = {posargs}
[flake8] [flake8]
# E123, E125 skipped as they are invalid PEP-8. # E123, E125 skipped as they are invalid PEP-8.
show-source = True show-source = True
ignore = E123,E125,W503 ignore = E123,E125,W503
builtins = _ builtins = _

View File

@ -1,3 +1,4 @@
---
- project: - project:
merge-mode: squash-merge merge-mode: squash-merge
default-branch: main default-branch: main
@ -8,4 +9,4 @@
gate: gate:
jobs: jobs:
- otc-tox-pep8 - otc-tox-pep8
- otc-tox-py39 - otc-tox-py39