Prevent CNR methods from auth-ing on non-app repos

This commit is contained in:
Joseph Schorr 2017-03-22 23:46:05 -04:00
parent bdda74d6df
commit 4c34b00b38
2 changed files with 26 additions and 0 deletions

View file

@ -0,0 +1,19 @@
import pytest
from werkzeug.exceptions import NotImplemented as NIE
from data import model
from endpoints.test.fixtures import app, appconfig, database_uri, init_db_path, sqlitedb_file
from endpoints.appr import require_app_repo_read
def test_require_app_repo_read(app):
called = [False]
# Ensure that trying to read an *image* repository fails.
@require_app_repo_read
def empty(**kwargs):
called[0] = True
with pytest.raises(NIE):
empty(namespace='devtable', package_name='simple')
assert not called[0]