Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
Loading items

Target

Select target project
0 results Searching
Select Git revision
Loading items
Show changes

Commits on Source 3

5 files
+ 21
238
Compare changes
  • Side-by-side
  • Inline

Files

+0 −230
Original line number Diff line number Diff line
@@ -18,77 +18,6 @@ before_script:
.build:
  stage: build

build:pip:
  extends: .build
  script:
  - python3 -m build
  artifacts:
    paths:
      - dist/*

build:apt:
  extends: .build
  script:
  - ./debian/create_changelog.py uffd > debian/changelog
  - export PYBUILD_INSTALL_ARGS="--install-lib=/usr/share/uffd/ --install-scripts=/usr/share/uffd/"
  - export DEB_BUILD_OPTIONS=nocheck
  - dpkg-buildpackage -us -uc
  - mv ../*.deb ./
  - dpkg-deb -I *.deb
  - dpkg-deb -c *.deb
  artifacts:
    paths:
    - ./*.deb

db_migrations_updated:
  stage: test
  needs: []
  script:
  - FLASK_APP=uffd FLASK_ENV=testing flask db upgrade
  - FLASK_APP=uffd FLASK_ENV=testing flask db migrate 2>&1 | grep -q 'No changes in schema detected'

linter:buster:
  image: registry.git.cccv.de/uffd/docker-images/buster
  stage: test
  needs: []
  script:
  - pip3 install $PYLINT_PIN pylint-gitlab pylint-flask-sqlalchemy # this force-updates jinja2 and some other packages!
  - python3 -m pylint --output-format=pylint_gitlab.GitlabCodeClimateReporter:codeclimate.json,pylint_gitlab.GitlabPagesHtmlReporter:pylint.html,colorized uffd
  artifacts:
    when: always
    paths:
    - pylint.html
    reports:
      codequality: codeclimate.json

linter:bullseye:
  image: registry.git.cccv.de/uffd/docker-images/bullseye
  stage: test
  needs: []
  script:
  - pip3 install $PYLINT_PIN pylint-gitlab pylint-flask-sqlalchemy # this force-updates jinja2 and some other packages!
  - python3 -m pylint --output-format=pylint_gitlab.GitlabCodeClimateReporter:codeclimate.json,pylint_gitlab.GitlabPagesHtmlReporter:pylint.html,colorized uffd
  artifacts:
    when: always
    paths:
    - pylint.html
    reports:
      codequality: codeclimate.json

linter:bookworm:
  image: registry.git.cccv.de/uffd/docker-images/bookworm
  stage: test
  needs: []
  script:
  - pip3 install $PYLINT_PIN pylint-gitlab pylint-flask-sqlalchemy # this force-updates jinja2 and some other packages!
  - python3 -m pylint --output-format=pylint_gitlab.GitlabCodeClimateReporter:codeclimate.json,pylint_gitlab.GitlabPagesHtmlReporter:pylint.html,colorized uffd
  artifacts:
    when: always
    paths:
    - pylint.html
    reports:
      codequality: codeclimate.json

tests:buster:sqlite:
  image: registry.git.cccv.de/uffd/docker-images/buster
  stage: test
@@ -100,18 +29,6 @@ tests:buster:sqlite:
    reports:
      junit: report.xml

tests:buster:mysql:
  image: registry.git.cccv.de/uffd/docker-images/buster
  stage: test
  needs: []
  script:
  - service mysql start
  - TEST_WITH_MYSQL=1 python3 -m pytest --junitxml=report.xml
  artifacts:
    when: always
    reports:
      junit: report.xml

tests:bullseye:sqlite:
  image: registry.git.cccv.de/uffd/docker-images/bullseye
  stage: test
@@ -123,18 +40,6 @@ tests:bullseye:sqlite:
    reports:
      junit: report.xml

tests:bullseye:mysql:
  image: registry.git.cccv.de/uffd/docker-images/bullseye
  stage: test
  needs: []
  script:
  - service mariadb start
  - TEST_WITH_MYSQL=1 python3 -m pytest --junitxml=report.xml
  artifacts:
    when: always
    reports:
      junit: report.xml

tests:bookworm:sqlite:
  image: registry.git.cccv.de/uffd/docker-images/bookworm
  stage: test
@@ -162,138 +67,3 @@ tests:bookworm:sqlite:
        path: coverage.xml
      junit: report.xml
  coverage: '/^TOTAL.*\s+(\d+\%)$/'

tests:bookworm:mysql:
  image: registry.git.cccv.de/uffd/docker-images/bookworm
  stage: test
  needs: []
  script:
  - service mariadb start
  - TEST_WITH_MYSQL=1 python3 -m pytest --junitxml=report.xml
  artifacts:
    when: always
    reports:
      junit: report.xml

html5validator:
  stage: test
  needs:
  - job: tests:bookworm:sqlite
  script:
  - html5validator --root pages 2>&1 | tee html5validator.log
  artifacts:
    when: on_failure
    paths:
    - pages
    - html5validator.log

.trans:
  stage: test
  needs: []
  script:
  - ./update_translations.sh $TRANSLATION_LANGUAGE
  coverage: '/^TOTAL.*\s+(\d+\%)$/'
trans_de:
  extends: .trans
  variables:
    TRANSLATION_LANGUAGE: de

test:package:pip:buster:
  image: registry.git.cccv.de/uffd/docker-images/buster
  stage: test
  needs:
  - job: build:pip
  script:
  - pip3 install dist/*.tar.gz

test:package:pip:bullseye:
  image: registry.git.cccv.de/uffd/docker-images/bullseye
  stage: test
  needs:
  - job: build:pip
  script:
  - pip3 install dist/*.tar.gz

test:package:pip:bookworm:
  image: registry.git.cccv.de/uffd/docker-images/bookworm
  stage: test
  needs:
  - job: build:pip
  script:
  - pip3 install dist/*.tar.gz

# Since we want to test if the package installs correctly on a fresh Debian
# install (has correct dependencies, etc.), we don't use uffd/docker-images
# here
test:package:apt:buster:
  image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/debian:buster
  stage: test
  needs:
  - job: build:apt
  before_script: []
  script:
  - apt -y update
  - apt -y install curl ./*.deb
  - service uwsgi start uffd || ( service uwsgi status uffd ; sleep 15; cat /var/log/uwsgi/app/uffd.log; )
  - echo "server { listen 127.0.0.1:5000 default_server;  include /etc/uffd/nginx.include.conf; }" > /etc/nginx/sites-enabled/uffd.ini
  - service nginx start || ( service nginx status; nginx -t; exit 1; )
  - uffd-admin routes
  - curl -Lv 127.0.0.1:5000

test:package:apt:bullseye:
  image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/debian:bullseye
  stage: test
  needs:
  - job: build:apt
  before_script: []
  script:
  - apt -y update
  - apt -y install curl ./*.deb
  - service uwsgi start uffd || ( service uwsgi status uffd ; sleep 15; cat /var/log/uwsgi/app/uffd.log; )
  - echo "server { listen 127.0.0.1:5000 default_server;  include /etc/uffd/nginx.include.conf; }" > /etc/nginx/sites-enabled/uffd.ini
  - service nginx start || ( service nginx status; nginx -t; exit 1; )
  - uffd-admin routes
  - curl -Lv 127.0.0.1:5000

test:package:apt:bookworm:
  image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/debian:bookworm
  stage: test
  needs:
  - job: build:apt
  before_script: []
  script:
  - apt -y update
  - apt -y install curl ./*.deb
  - service uwsgi start uffd || ( service uwsgi status uffd ; sleep 15; cat /var/log/uwsgi/app/uffd.log; )
  - echo "server { listen 127.0.0.1:5000 default_server;  include /etc/uffd/nginx.include.conf; }" > /etc/nginx/sites-enabled/uffd.ini
  - service nginx start || ( service nginx status; nginx -t; exit 1; )
  - uffd-admin routes
  - curl -Lv 127.0.0.1:5000

.publish:
  stage: deploy
  rules:
    - if: '$CI_COMMIT_TAG =~ /v[0-9]+[.][0-9]+[.][0-9]+.*/'

publish:pip:
  extends: .publish
  script:
  - TWINE_USERNAME="${GITLABPKGS_USERNAME}" TWINE_PASSWORD="${GITLABPKGS_PASSWORD}" python3 -m twine upload --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi dist/*
  - TWINE_USERNAME="${PYPI_USERNAME}" TWINE_PASSWORD="${PYPI_PASSWORD}" python3 -m twine upload dist/*
  dependencies:
  - build:pip

publish:apt:
  extends: .publish
  script:
  - export DEBPATH="$(echo *.deb)"
  - echo Upload deb file, add it to repo and clean up upload
  - curl --user "${APTLY_API_USER}:${APTLY_API_PW}" -X POST -F file=@"$DEBPATH" "${APT_API_URL}/api/files/${APT_REPO}-ci-upload-${CI_JOB_ID}"
  - curl --user "${APTLY_API_USER}:${APTLY_API_PW}" -X POST "${APT_API_URL}/api/repos/${APT_REPO}/file/${APT_REPO}-ci-upload-${CI_JOB_ID}"
  - curl --user "${APTLY_API_USER}:${APTLY_API_PW}" -X DELETE "${APT_API_URL}/api/files/${APT_REPO}-ci-upload-${CI_JOB_ID}"
  - echo Update published repo for all distros
  - 'curl --user "${APTLY_API_USER}:${APTLY_API_PW}" -X PUT -H "Content-Type: application/json" --data "{ }" "${APT_API_URL}/api/publish/uffd/buster"'
  - 'curl --user "${APTLY_API_USER}:${APTLY_API_PW}" -X PUT -H "Content-Type: application/json" --data "{ }" "${APT_API_URL}/api/publish/uffd/bullseye"'
  - 'curl --user "${APTLY_API_USER}:${APTLY_API_PW}" -X PUT -H "Content-Type: application/json" --data "{ }" "${APT_API_URL}/api/publish/uffd/bookworm"'
  dependencies:
  - build:apt
Original line number Diff line number Diff line
@@ -70,14 +70,15 @@ class TestOAuth2Key(UffdTestCase):
		})

	def test_encode_jwt(self):
		jwtdata = self.key.encode_jwt({'aud': 'test', 'foo': 'bar'})
		jwt_data = self.key.encode_jwt({'aud': 'test', 'foo': 'bar'})
		self.assertIsInstance(jwt_data, str)
		self.assertEqual(
			jwt.get_unverified_header(jwtdata),
			jwt.get_unverified_header(jwt_data),
			# typ is optional, x5u/x5c/jku/jwk are discoraged by OIDC Core 1.0 spec section 2
			{'kid': self.key.id, 'alg': self.key.algorithm, 'typ': 'JWT'}
		)
		self.assertEqual(
      OAuth2Key.decode_jwt(jwtdata, audience='test'),
			OAuth2Key.decode_jwt(jwt_data, audience='test'),
			{'aud': 'test', 'foo': 'bar'}
		)
		self.key.active = False

tests/test_jsonify.py

0 → 100644
+9 −0
Original line number Diff line number Diff line
from flask import jsonify

from tests.utils import UffdTestCase

class TestViews(UffdTestCase):
	def test_jsonify(self):
		print(repr(jsonify({'foo': 'bar'}).data))
		print(repr(jsonify({'foo': b'bar'}).data))
		self.assertTrue(False)