Skip to content

Commit

Permalink
enable deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jlaney committed Feb 13, 2024
1 parent 95b483b commit d864932
Show file tree
Hide file tree
Showing 14 changed files with 40 additions and 45 deletions.
21 changes: 9 additions & 12 deletions .github/workflows/cicd.yml
Expand Up @@ -28,7 +28,7 @@ name: tests
env:
APP_NAME: rc_django
CONF_PATH: conf
COVERAGE_DJANGO_VERSION: 3.2
COVERAGE_DJANGO_VERSION: '4.2'

on:
push:
Expand All @@ -42,15 +42,13 @@ on:

jobs:
test:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

strategy:
matrix:
django-version:
- '2.2'
- '3.2'
- '4.0'
- '4.1'
- '4.2'

steps:
- name: Checkout Repo
Expand All @@ -59,16 +57,15 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: '3.10'

- name: Install Dependencies
run: |
sudo apt-get install python-dev libxml2-dev libxmlsec1-dev
python -m pip install --upgrade pip
pip install -e .
pip install coverage coveralls==2.2.0
pip install coverage coveralls==3.3.1
- name: Upgrade Django Version
- name: Install Django ${{ matrix.django-version }}
run: pip install "Django~=${{ matrix.django-version }}.0"

- name: Setup Django
Expand All @@ -89,7 +86,7 @@ jobs:
- name: Run Tests
run: |
python -m compileall ${APP_NAME}/
coverage run --source=${APP_NAME}/ manage.py test ${APP_NAME}
python -Wd -m coverage run --source=${APP_NAME}/ manage.py test ${APP_NAME}
- name: Report Test Coverage
if: matrix.django-version == env.COVERAGE_DJANGO_VERSION
Expand All @@ -103,7 +100,7 @@ jobs:

needs: test

runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- name: Checkout Repo
Expand All @@ -112,7 +109,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: '3.10'

- name: Publish to PyPi
uses: uw-it-aca/actions/publish-pypi@main
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -3,7 +3,7 @@
[![Build Status](https://github.com/uw-it-aca/uw-restclients-django-utils/workflows/tests/badge.svg?branch=main)](https://github.com/uw-it-aca/uw-restclients-django-utils/actions)
[![Coverage Status](https://coveralls.io/repos/uw-it-aca/uw-restclients-django-utils/badge.svg?branch=main)](https://coveralls.io/r/uw-it-aca/uw-restclients-django-utils?branch=main)
[![PyPi Version](https://img.shields.io/pypi/v/uw-restclients-django-utils.svg)](https://pypi.python.org/pypi/uw-restclients-django-utils)
![Python versions](https://img.shields.io/pypi/pyversions/uw-restclients-django-utils.svg)
![Python versions](https://img.shields.io/badge/python-3.10-blue.svg)


This project uses a function defined in your app to control access to the restclient proxy views, configured as RESTCLIENTS_ADMIN_AUTH_MODULE in your settings.py.
Expand Down
2 changes: 1 addition & 1 deletion rc_django/decorators.py
@@ -1,4 +1,4 @@
# Copyright 2023 UW-IT, University of Washington
# Copyright 2024 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0


Expand Down
2 changes: 1 addition & 1 deletion rc_django/middleware.py
@@ -1,4 +1,4 @@
# Copyright 2023 UW-IT, University of Washington
# Copyright 2024 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0


Expand Down
2 changes: 1 addition & 1 deletion rc_django/models.py
@@ -1,4 +1,4 @@
# Copyright 2023 UW-IT, University of Washington
# Copyright 2024 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0


Expand Down
2 changes: 1 addition & 1 deletion rc_django/tests/__init__.py
@@ -1,4 +1,4 @@
# Copyright 2023 UW-IT, University of Washington
# Copyright 2024 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

def can_proxy_restclient(request, service, url):
Expand Down
8 changes: 4 additions & 4 deletions rc_django/tests/performance/test_delay.py
@@ -1,4 +1,4 @@
# Copyright 2023 UW-IT, University of Washington
# Copyright 2024 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0


Expand Down Expand Up @@ -79,12 +79,12 @@ def test_degraded(self):
t1 = time.time()
response = client.getURL("/test", {})
t2 = time.time()
self.assertEquals(response.status, 500)
self.assertEquals(response.data, "[oops")
self.assertEqual(response.status, 500)
self.assertEqual(response.data, "[oops")

self.assertGreater(t2-t1, 0.09)

EnableServiceDegradationMiddleware(get_response).process_request(r2)

response = client.getURL("/test", {})
self.assertEquals(response.status, 200)
self.assertEqual(response.status, 200)
6 changes: 3 additions & 3 deletions rc_django/tests/test_models.py
@@ -1,4 +1,4 @@
# Copyright 2023 UW-IT, University of Washington
# Copyright 2024 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0


Expand All @@ -19,7 +19,7 @@ def setUp(self):

def test_dao_instance(self):
self.assertEqual(type(RestProxy("test").dao), TEST_DAO)
self.assertEquals(type(RestProxy("test_sub").dao), SUB_DAO)
self.assertEqual(type(RestProxy("test_sub").dao), SUB_DAO)

# Missing service
proxy = RestProxy("fake")
Expand All @@ -36,7 +36,7 @@ def test_simple(self):
closed = "<div/>"
valid = "<!-- <div/> --><div></div>"

self.assertEquals(valid, self.proxy.clean_self_closing_divs(closed))
self.assertEqual(valid, self.proxy.clean_self_closing_divs(closed))

def test_2_simple(self):
closed = '<div/><div id="1"/>'
Expand Down
26 changes: 13 additions & 13 deletions rc_django/tests/test_views.py
@@ -1,4 +1,4 @@
# Copyright 2023 UW-IT, University of Washington
# Copyright 2024 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0


Expand Down Expand Up @@ -75,11 +75,11 @@ def test_service_errors(self):
# No auth module in settings
url = reverse("restclients_proxy", args=["test", "test/v1"])
response = self.client.get(url)
self.assertEquals(response.status_code, 401)
self.assertEqual(response.status_code, 401)

url = reverse("restclients_customform", args=["test", "index.html"])
response = self.client.get(url)
self.assertEquals(response.status_code, 401)
self.assertEqual(response.status_code, 401)


@override_settings(
Expand Down Expand Up @@ -110,12 +110,12 @@ def test_support_links(self):
password=get_user_pass('test_view'))

response = self.client.get(url)
self.assertEquals(response.status_code, 200)
self.assertEqual(response.status_code, 200)

url = reverse("restclients_proxy", args=[
"test", "test/v1?a=one&b=two&c=one%20two"])
response = self.client.get(url)
self.assertEquals(response.status_code, 200)
self.assertEqual(response.status_code, 200)

def test_service_errors(self):
get_user('test_view')
Expand All @@ -125,12 +125,12 @@ def test_service_errors(self):
# Unauthorized service
url = reverse("restclients_proxy", args=["secret", "test/v1"])
response = self.client.get(url)
self.assertEquals(response.status_code, 401)
self.assertEqual(response.status_code, 401)

# Missing service
url = reverse("restclients_proxy", args=["fake", "test/v1"])
response = self.client.get(url)
self.assertEquals(response.status_code, 404)
self.assertEqual(response.status_code, 404)
self.assertIn(b"Missing service: fake", response.content)


Expand All @@ -152,20 +152,20 @@ def test_search_post(self):
# missing form values
url = reverse("restclients_customform", args=["libcurrics", "default"])
response = self.client.post(url)
self.assertEquals(response.status_code, 400)
self.assertEqual(response.status_code, 400)
self.assertIn(b"Missing reqired form value: 'campus'",
response.content)

url = reverse("restclients_customform", args=["libcurrics", "default"])
response = self.client.post(url, {"campus": "sea"})
self.assertEquals(response.status_code, 302)
self.assertEqual(response.status_code, 302)
self.assertEqual(
response.url,
"/view/libcurrics/currics_db/api/v1/data/defaultGuide/sea")

url = reverse("restclients_customform", args=["libraries", "accounts"])
response = self.client.post(url, {"id": "\xae"})
self.assertEquals(response.status_code, 302)
self.assertEqual(response.status_code, 302)
self.assertEqual(response.url,
"/view/libraries/mylibinfo/v1/?id=%C2%AE")

Expand All @@ -185,18 +185,18 @@ def test_customform(self):

# no auth
response = self.client.get(url)
self.assertEquals(response.status_code, 302)
self.assertEqual(response.status_code, 302)
self.assertTrue("next=/search/libraries/index.html" in response.url)

# with auth
get_user('test_view')
self.client.login(username='test_view',
password=get_user_pass('test_view'))
response = self.client.get(url)
self.assertEquals(response.status_code, 200)
self.assertEqual(response.status_code, 200)
self.assertIn(b'<form method="post" action="/search/libraries/index">',
response.content)

url = reverse("restclients_customform", args=["fake", "index.html"])
response = self.client.get(url)
self.assertEquals(response.status_code, 404)
self.assertEqual(response.status_code, 404)
3 changes: 1 addition & 2 deletions rc_django/urls.py
@@ -1,7 +1,6 @@
# Copyright 2023 UW-IT, University of Washington
# Copyright 2024 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0


from django.urls import re_path
from rc_django.views.errors import DegradePerformanceView
from rc_django.views.rest_proxy import RestSearchView, RestProxyView
Expand Down
2 changes: 1 addition & 1 deletion rc_django/views/__init__.py
@@ -1,4 +1,4 @@
# Copyright 2023 UW-IT, University of Washington
# Copyright 2024 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0


Expand Down
2 changes: 1 addition & 1 deletion rc_django/views/errors.py
@@ -1,4 +1,4 @@
# Copyright 2023 UW-IT, University of Washington
# Copyright 2024 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0


Expand Down
2 changes: 1 addition & 1 deletion rc_django/views/rest_proxy.py
@@ -1,4 +1,4 @@
# Copyright 2023 UW-IT, University of Washington
# Copyright 2024 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0


Expand Down
5 changes: 2 additions & 3 deletions setup.py
Expand Up @@ -18,11 +18,11 @@
name='UW-RestClients-Django-Utils',
version=VERSION,
packages=['rc_django'],
author="UW-IT AXDD",
author="UW-IT T&LS",
author_email="aca-it@uw.edu",
include_package_data=True,
install_requires=[
'Django>2.2,<5',
'Django>3.2,<5',
'UW-RestClients-Core',
'django-userservice',
],
Expand All @@ -35,6 +35,5 @@
'License :: OSI Approved :: Apache Software License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3.8',
],
)

0 comments on commit d864932

Please sign in to comment.