Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions REUSE.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ SPDX-FileCopyrightText = "2016-2025 Nextcloud translators"
SPDX-License-Identifier = "AGPL-3.0-or-later"

[[annotations]]
path = [".tx/config", "docs/developer.rst", "docs/documentation.rst", "docs/index.rst", "docs/translation.rst", "nextcloudappstore/api/v1/tests/data/archives/appinfosymlink.tar.gz", "nextcloudappstore/api/v1/tests/data/archives/appsymlink.tar.gz", "nextcloudappstore/api/v1/tests/data/archives/changelog.tar.gz", "nextcloudappstore/api/v1/tests/data/archives/contacts.tar.gz", "nextcloudappstore/api/v1/tests/data/archives/empty.zip", "nextcloudappstore/api/v1/tests/data/archives/full.tar.gz", "nextcloudappstore/api/v1/tests/data/archives/invalid.tar.gz", "nextcloudappstore/api/v1/tests/data/archives/invalidname.tar.gz", "nextcloudappstore/api/v1/tests/data/archives/minimal.tar.gz", "nextcloudappstore/api/v1/tests/data/archives/multiplefolders.tar.gz", "nextcloudappstore/api/v1/tests/data/archives/symlink.tar.gz", "nextcloudappstore/api/v1/tests/data/archives/twofactor_u2f.tar.gz", "nextcloudappstore/certificate/tests/data/archives/minimal.tar.gz", "nextcloudappstore/api/v1/tests/data/certificates/news-old.crt", "nextcloudappstore/api/v1/tests/data/infoxmls/badcommand.xml", "nextcloudappstore/api/v1/tests/data/infoxmls/broken-xml.xml", "nextcloudappstore/api/v1/tests/data/infoxmls/digits.xml", "nextcloudappstore/api/v1/tests/data/infoxmls/entities.xml", "nextcloudappstore/api/v1/tests/data/infoxmls/full.xml", "nextcloudappstore/api/v1/tests/data/infoxmls/fullimport.xml", "nextcloudappstore/api/v1/tests/data/infoxmls/invalid.xml", "nextcloudappstore/api/v1/tests/data/infoxmls/invalid-elements.xml", "nextcloudappstore/api/v1/tests/data/infoxmls/minimal.xml", "nextcloudappstore/api/v1/tests/data/infoxmls/news.xml", "nextcloudappstore/api/v1/tests/data/infoxmls/nextcloud.xml", "nextcloudappstore/api/v1/tests/data/infoxmls/no_en_description.xml", "nextcloudappstore/api/v1/tests/data/infoxmls/no_en_name.xml", "nextcloudappstore/api/v1/tests/data/infoxmls/no_en_summary.xml", "nextcloudappstore/api/v1/tests/data/infoxmls/prerelease.xml", "nextcloudappstore/api/v1/tests/data/infoxmls/repair-and-jobs.xml", "nextcloudappstore/api/v1/tests/data/infoxmls/settings-and-activity-and-nav.xml", "nextcloudappstore/core/fixtures/categories.json", "nextcloudappstore/core/fixtures/databases.json", "nextcloudappstore/core/fixtures/licenses.json", "nextcloudappstore/core/static/assets/img/banner.jpg"]
path = [".tx/config", "docs/developer.rst", "docs/documentation.rst", "docs/index.rst", "docs/translation.rst", "nextcloudappstore/api/v1/tests/data/archives/appinfosymlink.tar.gz", "nextcloudappstore/api/v1/tests/data/archives/appsymlink.tar.gz", "nextcloudappstore/api/v1/tests/data/archives/changelog.tar.gz", "nextcloudappstore/api/v1/tests/data/archives/contacts.tar.gz", "nextcloudappstore/api/v1/tests/data/archives/empty.zip", "nextcloudappstore/api/v1/tests/data/archives/full.tar.gz", "nextcloudappstore/api/v1/tests/data/archives/invalid.tar.gz", "nextcloudappstore/api/v1/tests/data/archives/invalidname.tar.gz", "nextcloudappstore/api/v1/tests/data/archives/minimal.tar.gz", "nextcloudappstore/api/v1/tests/data/archives/multiplefolders.tar.gz", "nextcloudappstore/api/v1/tests/data/archives/symlink.tar.gz", "nextcloudappstore/api/v1/tests/data/archives/twofactor_u2f.tar.gz", "nextcloudappstore/certificate/tests/data/archives/minimal.tar.gz", "nextcloudappstore/api/v1/tests/data/infoxmls/badcommand.xml", "nextcloudappstore/api/v1/tests/data/infoxmls/broken-xml.xml", "nextcloudappstore/api/v1/tests/data/infoxmls/digits.xml", "nextcloudappstore/api/v1/tests/data/infoxmls/entities.xml", "nextcloudappstore/api/v1/tests/data/infoxmls/full.xml", "nextcloudappstore/api/v1/tests/data/infoxmls/fullimport.xml", "nextcloudappstore/api/v1/tests/data/infoxmls/invalid.xml", "nextcloudappstore/api/v1/tests/data/infoxmls/invalid-elements.xml", "nextcloudappstore/api/v1/tests/data/infoxmls/minimal.xml", "nextcloudappstore/api/v1/tests/data/infoxmls/news.xml", "nextcloudappstore/api/v1/tests/data/infoxmls/nextcloud.xml", "nextcloudappstore/api/v1/tests/data/infoxmls/no_en_description.xml", "nextcloudappstore/api/v1/tests/data/infoxmls/no_en_name.xml", "nextcloudappstore/api/v1/tests/data/infoxmls/no_en_summary.xml", "nextcloudappstore/api/v1/tests/data/infoxmls/prerelease.xml", "nextcloudappstore/api/v1/tests/data/infoxmls/repair-and-jobs.xml", "nextcloudappstore/api/v1/tests/data/infoxmls/settings-and-activity-and-nav.xml", "nextcloudappstore/core/fixtures/categories.json", "nextcloudappstore/core/fixtures/databases.json", "nextcloudappstore/core/fixtures/licenses.json", "nextcloudappstore/core/static/assets/img/banner.jpg"]
precedence = "aggregate"
SPDX-FileCopyrightText = "2016 Nextcloud GmbH and Nextcloud contributors"
SPDX-License-Identifier = "AGPL-3.0-or-later"
Expand All @@ -24,7 +24,7 @@ SPDX-FileCopyrightText = "2016 Nextcloud GmbH"
SPDX-License-Identifier = "LicenseRef-NextcloudTrademarks"

[[annotations]]
path = [".idea/**", "appstore.iml", "package-lock.json", "package.json", "tsconfig.json", "docs/devinstall.rst", "docs/prodinstall.rst", "docs/storedeveloper.rst", "nextcloudappstore/core/static/assets/img/ajax-loader.gif", "nextcloudappstore/core/static/assets/img/loading.gif", "nextcloudappstore/api/v1/tests/data/archives/database.tar.gz", "nextcloudappstore/api/v1/tests/data/database/broken.xml", "nextcloudappstore/api/v1/tests/data/database/invaliddb.xml", "nextcloudappstore/api/v1/tests/data/database/invaliddeclaration.xml", "nextcloudappstore/api/v1/tests/data/database/invalidfield.xml", "nextcloudappstore/api/v1/tests/data/database/invalidindex.xml", "nextcloudappstore/api/v1/tests/data/database/invalidindexfield.xml", "nextcloudappstore/api/v1/tests/data/database/invalidtable.xml", "nextcloudappstore/api/v1/tests/data/database/nameafterdecl.xml", "nextcloudappstore/api/v1/tests/data/database/news.xml", "nextcloudappstore/api/v1/tests/data/database/server.xml", "nextcloudappstore/api/v1/tests/data/infoxmls/authmigration.xml", "nextcloudappstore/api/v1/tests/data/infoxmls/collaboration.xml", "nextcloudappstore/api/v1/tests/data/infoxmls/sabre.xml", "nextcloudappstore/certificate/tests/data/certificates/app.crt", "nextcloudappstore/certificate/tests/data/certificates/bad-news-old-minimal.sig", "nextcloudappstore/certificate/tests/data/certificates/empty.crl", "nextcloudappstore/certificate/tests/data/certificates/imaginary-revoked1.crt", "nextcloudappstore/certificate/tests/data/certificates/imaginary-revoked2.crt", "nextcloudappstore/certificate/tests/data/certificates/imaginary-valid.crt", "nextcloudappstore/certificate/tests/data/certificates/imaginary.chain", "nextcloudappstore/certificate/tests/data/certificates/imaginary.crl", "nextcloudappstore/certificate/tests/data/certificates/news-old-app-id.sig", "nextcloudappstore/certificate/tests/data/certificates/news-old-minimal.sig", "nextcloudappstore/certificate/tests/data/certificates/news-old.crt", "nextcloudappstore/certificate/tests/data/certificates/nextcloud.crt", "nextcloudappstore/certificate/tests/data/certificates/owncloud.crt", "nextcloudappstore/core/tests/e2e/data/app.crt", "nextcloudappstore/core/tests/e2e/data/app.key", "nextcloudappstore/core/tests/e2e/data/ca.crl", "nextcloudappstore/core/tests/e2e/data/ca.crt", "nextcloudappstore/core/tests/e2e/data/ca.key", "nextcloudappstore/core/tests/e2e/fixtures/admin.json", "nextcloudappstore/core/tests/e2e/fixtures/apps.json", "nextcloudappstore/core/tests/e2e/fixtures/nextcloudreleases.json"]
path = [".idea/**", "appstore.iml", "package-lock.json", "package.json", "tsconfig.json", "docs/devinstall.rst", "docs/prodinstall.rst", "docs/storedeveloper.rst", "nextcloudappstore/core/static/assets/img/ajax-loader.gif", "nextcloudappstore/core/static/assets/img/loading.gif", "nextcloudappstore/api/v1/tests/data/archives/database.tar.gz", "nextcloudappstore/api/v1/tests/data/database/broken.xml", "nextcloudappstore/api/v1/tests/data/database/invaliddb.xml", "nextcloudappstore/api/v1/tests/data/database/invaliddeclaration.xml", "nextcloudappstore/api/v1/tests/data/database/invalidfield.xml", "nextcloudappstore/api/v1/tests/data/database/invalidindex.xml", "nextcloudappstore/api/v1/tests/data/database/invalidindexfield.xml", "nextcloudappstore/api/v1/tests/data/database/invalidtable.xml", "nextcloudappstore/api/v1/tests/data/database/nameafterdecl.xml", "nextcloudappstore/api/v1/tests/data/database/news.xml", "nextcloudappstore/api/v1/tests/data/database/server.xml", "nextcloudappstore/api/v1/tests/data/infoxmls/authmigration.xml", "nextcloudappstore/api/v1/tests/data/infoxmls/collaboration.xml", "nextcloudappstore/api/v1/tests/data/infoxmls/sabre.xml", "nextcloudappstore/certificate/tests/data/certificates/bad-news-old-minimal.sig", "nextcloudappstore/certificate/tests/data/certificates/empty.crl", "nextcloudappstore/certificate/tests/data/certificates/imaginary-revoked1.crt", "nextcloudappstore/certificate/tests/data/certificates/imaginary-revoked2.crt", "nextcloudappstore/certificate/tests/data/certificates/imaginary-valid.crt", "nextcloudappstore/certificate/tests/data/certificates/imaginary.chain", "nextcloudappstore/certificate/tests/data/certificates/imaginary.crl", "nextcloudappstore/certificate/tests/data/certificates/news-old-app-id.sig", "nextcloudappstore/certificate/tests/data/certificates/news-old-minimal.sig", "nextcloudappstore/certificate/tests/data/certificates/nextcloud.crt", "nextcloudappstore/core/tests/e2e/data/app.crt", "nextcloudappstore/core/tests/e2e/data/app.key", "nextcloudappstore/core/tests/e2e/data/ca.crl", "nextcloudappstore/core/tests/e2e/data/ca.crt", "nextcloudappstore/core/tests/e2e/data/ca.key", "nextcloudappstore/core/tests/e2e/fixtures/admin.json", "nextcloudappstore/core/tests/e2e/fixtures/apps.json", "nextcloudappstore/core/tests/e2e/fixtures/nextcloudreleases.json"]
precedence = "aggregate"
SPDX-FileCopyrightText = "2017 Nextcloud GmbH and Nextcloud contributors"
SPDX-License-Identifier = "AGPL-3.0-or-later"
Expand Down
29 changes: 0 additions & 29 deletions nextcloudappstore/api/v1/tests/data/certificates/news-old.crt

This file was deleted.

59 changes: 1 addition & 58 deletions nextcloudappstore/api/v1/tests/test_app_register.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,14 @@
SPDX-License-Identifier: AGPL-3.0-or-later
"""

from django.contrib.auth import get_user_model
from django.urls import reverse

from nextcloudappstore.api.v1.tests.api import ApiTest
from nextcloudappstore.core.facades import read_relative_file
from nextcloudappstore.core.models import App, AppRelease
from nextcloudappstore.core.models import App


class AppRegisterTest(ApiTest):
create_url = reverse("api:v1:app-register")
_cert = read_relative_file(__file__, "../../../certificate/tests/data/certificates/news-old.crt").strip()

def _create_app(self, owner, app_id):
return App.objects.create(owner=owner, id=app_id)
Expand All @@ -23,57 +20,3 @@ def test_register_unauthenticated(self):
self.create_url, data={"signature": "sign", "certificate": "cert"}, format="json"
)
self.assertEqual(401, response.status_code)

def test_register_unauthorized(self):
owner = get_user_model().objects.create_user(username="owner", password="owner", email="owner@owner.com")
self._create_app(owner, "news")
self._login_token()
with self.settings(VALIDATE_CERTIFICATES=False):
response = self.api_client.post(
self.create_url, data={"signature": "sign", "certificate": self._cert}, format="json"
)
self.assertEqual(403, response.status_code)

def test_register_transfer(self):
owner = get_user_model().objects.create_user(username="owner", password="owner", email="owner@owner.com")
app = self._create_app(owner, "news")
app.ownership_transfer_enabled = True
app.save()
self._login_token()
with self.settings(VALIDATE_CERTIFICATES=False):
response = self.api_client.post(
self.create_url, data={"signature": "sign", "certificate": self._cert}, format="json"
)
self.assertEqual(204, response.status_code)
app = App.objects.get(id="news")
self.assertEqual(self.user, app.owner)
self.assertFalse(app.ownership_transfer_enabled)

def test_register(self):
self._login()
with self.settings(VALIDATE_CERTIFICATES=False):
response = self.api_client.post(
self.create_url, data={"signature": "sign", "certificate": self._cert}, format="json"
)
self.assertEqual(201, response.status_code)
app = App.objects.get(id="news")
self.assertEqual(self.user, app.owner)
self.assertEqual(self._cert, app.certificate)

def test_register_update(self):
app = self._create_app(self.user, "news")
app.certificate = "blubb"
app.save()
AppRelease.objects.create(version="1.0.0", app=app)

self.assertEqual(1, App.objects.get(id="news").releases.all().count())
self._login()
with self.settings(VALIDATE_CERTIFICATES=False):
response = self.api_client.post(
self.create_url, data={"signature": "sign", "certificate": self._cert}, format="json"
)
self.assertEqual(204, response.status_code)
app = App.objects.get(id="news")
self.assertEqual(self.user, app.owner)
self.assertEqual(self._cert, app.certificate)
self.assertEqual(0, app.releases.all().count())
24 changes: 0 additions & 24 deletions nextcloudappstore/certificate/tests/data/certificates/app.crt

This file was deleted.

29 changes: 0 additions & 29 deletions nextcloudappstore/certificate/tests/data/certificates/news-old.crt

This file was deleted.

Loading
Loading