From 1d9c6a6a30b1537350667cc096825ee6389b53ba Mon Sep 17 00:00:00 2001
From: Mangabo Kolawole <32314456+koladev32@users.noreply.github.com>
Date: Thu, 23 May 2024 03:11:43 +0100
Subject: [PATCH] Revert ":recycle: big renaming"
---
CHANGELOG.md | 5 ---
Makefile | 2 +-
README.md | 38 +++++++++----------
docs/analytics.rst | 12 +++---
docs/authentication.rst | 6 +--
docs/customizing_api_key_model.rst | 2 +-
docs/getting_started.rst | 16 ++++----
docs/index.rst | 10 ++---
docs/permissions.rst | 4 +-
docs/rotation.rst | 10 ++---
docs/settings.rst | 4 +-
drf_apikey/version.py | 1 -
example/ApiKey/settings.py | 4 +-
example/fruits/viewsets.py | 4 +-
example/requirements.txt | 2 +-
pyproject.toml | 4 +-
.../__init__.py | 2 +-
.../admin.py | 0
.../analytics/__init__.py | 0
.../analytics/admin.py | 0
.../analytics/apps.py | 4 +-
.../analytics/middleware.py | 8 ++--
.../analytics/migrations/0001_initial.py | 4 +-
.../analytics/migrations/__init__.py | 0
.../analytics/models.py | 2 +-
.../apps.py | 2 +-
.../backends.py | 6 +--
.../crypto.py | 6 +--
.../management/__init__.py | 0
.../management/commands/__init__.py | 0
.../commands/generate_fernet_key.py | 0
.../management/commands/rotation.py | 4 +-
.../migrations/0001_initial.py | 4 +-
.../migrations/0002_alter_apikey_options.py | 2 +-
.../migrations/__init__.py | 0
.../models.py | 4 +-
.../mutli_api_crypto.py | 4 +-
.../parser.py | 2 +-
.../permissions.py | 0
.../rotation/__init__.py | 0
.../rotation/admin.py | 0
.../rotation/apps.py | 4 +-
.../rotation/migrations/0001_initial.py | 0
.../rotation/migrations/__init__.py | 0
.../rotation/models.py | 0
.../rotation/utils.py | 4 +-
.../settings.py | 10 ++---
.../utils.py | 0
rest_framework_simple_api_key/version.py | 1 +
scripts/makemigrations.py | 8 ++--
setup.cfg | 8 ++--
tests/conftest.py | 14 +++----
tests/fixtures/api_key.py | 2 +-
tests/test_admin.py | 4 +-
tests/test_analytics.py | 2 +-
tests/test_analytics_middleware.py | 8 ++--
tests/test_api_authentication.py | 4 +-
tests/test_api_key_crypto.py | 2 +-
tests/test_api_key_multi_crypto.py | 6 +--
tests/test_models.py | 2 +-
tests/test_permissions.py | 6 +--
61 files changed, 128 insertions(+), 135 deletions(-)
delete mode 100644 drf_apikey/version.py
rename {drf_apikey => rest_framework_simple_api_key}/__init__.py (87%)
rename {drf_apikey => rest_framework_simple_api_key}/admin.py (100%)
rename {drf_apikey => rest_framework_simple_api_key}/analytics/__init__.py (100%)
rename {drf_apikey => rest_framework_simple_api_key}/analytics/admin.py (100%)
rename {drf_apikey => rest_framework_simple_api_key}/analytics/apps.py (54%)
rename {drf_apikey => rest_framework_simple_api_key}/analytics/middleware.py (70%)
rename {drf_apikey => rest_framework_simple_api_key}/analytics/migrations/0001_initial.py (88%)
rename {drf_apikey => rest_framework_simple_api_key}/analytics/migrations/__init__.py (100%)
rename {drf_apikey => rest_framework_simple_api_key}/analytics/models.py (96%)
rename {drf_apikey => rest_framework_simple_api_key}/apps.py (74%)
rename {drf_apikey => rest_framework_simple_api_key}/backends.py (93%)
rename {drf_apikey => rest_framework_simple_api_key}/crypto.py (90%)
rename {drf_apikey => rest_framework_simple_api_key}/management/__init__.py (100%)
rename {drf_apikey => rest_framework_simple_api_key}/management/commands/__init__.py (100%)
rename {drf_apikey => rest_framework_simple_api_key}/management/commands/generate_fernet_key.py (100%)
rename {drf_apikey => rest_framework_simple_api_key}/management/commands/rotation.py (91%)
rename {drf_apikey => rest_framework_simple_api_key}/migrations/0001_initial.py (93%)
rename {drf_apikey => rest_framework_simple_api_key}/migrations/0002_alter_apikey_options.py (85%)
rename {drf_apikey => rest_framework_simple_api_key}/migrations/__init__.py (100%)
rename {drf_apikey => rest_framework_simple_api_key}/models.py (94%)
rename {drf_apikey => rest_framework_simple_api_key}/mutli_api_crypto.py (85%)
rename {drf_apikey => rest_framework_simple_api_key}/parser.py (94%)
rename {drf_apikey => rest_framework_simple_api_key}/permissions.py (100%)
rename {drf_apikey => rest_framework_simple_api_key}/rotation/__init__.py (100%)
rename {drf_apikey => rest_framework_simple_api_key}/rotation/admin.py (100%)
rename {drf_apikey => rest_framework_simple_api_key}/rotation/apps.py (54%)
rename {drf_apikey => rest_framework_simple_api_key}/rotation/migrations/0001_initial.py (100%)
rename {drf_apikey => rest_framework_simple_api_key}/rotation/migrations/__init__.py (100%)
rename {drf_apikey => rest_framework_simple_api_key}/rotation/models.py (100%)
rename {drf_apikey => rest_framework_simple_api_key}/rotation/utils.py (88%)
rename {drf_apikey => rest_framework_simple_api_key}/settings.py (81%)
rename {drf_apikey => rest_framework_simple_api_key}/utils.py (100%)
create mode 100644 rest_framework_simple_api_key/version.py
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 88cd59a..bcf01d4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,11 +4,6 @@ Changelog
[Unreleased]
------------
-[v2.0.0] - 2024-05-23
-------------------
-
-- Rename project (#56)
-
[v1.1.1] - 2024-05-23
------------------
diff --git a/Makefile b/Makefile
index 6fc41ce..7ce0cfc 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
venv = venv
bin = ${venv}/bin/
-pysources = drf-apikey/ example/ tests/
+pysources = rest_framework_simple_api_key/ example/ tests/
build:
${bin}python -m build
diff --git a/README.md b/README.md
index b81c193..e3163af 100644
--- a/README.md
+++ b/README.md
@@ -3,15 +3,15 @@
Django REST Framework Simple API Key is a fast and secure API Key authentication plugin for REST API built with [Django Rest Framework](https://www.django-rest-framework.org/).
-For the full documentation, visit [https://djangorestframework-simple-apikey.readthedocs.io/en/latest/](https://djangorestframework-simple-apikey.readthedocs.io/en/latest/).
+For the full documentation, visit [https://drf-apikey.readthedocs.io/en/latest/](https://djangorestframework-simple-apikey.readthedocs.io/en/latest/).
## Package Renaming Notice
@@ -21,7 +21,6 @@ For the full documentation, visit [https://djangorestframework-simple-apikey.rea
```bash
pip uninstall djangorestframework-simple-apikey
pip install drf-apikey
-For the full documentation, visit [https://djangorestframework-simple-apikey.readthedocs.io/en/latest/](https://djangorestframework-simple-apikey.readthedocs.io/en/latest/).
## Introduction
@@ -35,7 +34,7 @@ Why should you use this package for your API Key authentication?
* 🔐 **Secure**: Fernet guarantees that a message encrypted using it cannot be manipulated or read without the key, which we call `FERNET_KEY`. As long as you treat the fernet key at the same level you treat the Django `SECRET_KEY` setting, you are good to go.
-* 🔧 **Customizable**: The models, authentication backend, and permissions classes can be rewritten and fit your needs. We do our best to extend Django classes and methods, so you can easily extend our classes and methods.😉 Your Api Key authentication settings are kept in a single configuration dictionary named `DRF_API_KEY` in the `settings.py` file of your Django project. It can be customized to fit your project needs.
+* 🔧 **Customizable**: The models, authentication backend, and permissions classes can be rewritten and fit your needs. We do our best to extend Django classes and methods, so you can easily extend our classes and methods.😉 Your Api Key authentication settings are kept in a single configuration dictionary named `SIMPLE_API_KEY` in the `settings.py` file of your Django project. It can be customized to fit your project needs.
## Quickstart
@@ -43,7 +42,7 @@ Why should you use this package for your API Key authentication?
1 - Install with `pip`:
```bash
-pip install drf-apikey
+pip install djangorestframework-simple-apikey
```
2 - Register the app in the `INSTALLED_APPS` in the `settings.py` file:
@@ -54,14 +53,14 @@ pip install drf-apikey
INSTALLED_APPS = [
# ...
"rest_framework",
- "drf_apikey",
+ "rest_framework_simple_api_key",
]
```
-3- Add the `FERNET_KEY` setting in your `DRF_API_KEY` configuration dictionary. You can easily generate a fernet key using the `python manage.py generate_fernet_key` command. Keep in mind that the fernet key plays a huge role in the api key authentication system.
+3- Add the `FERNET_KEY` setting in your `SIMPLE_API_KEY` configuration dictionary. You can easily generate a fernet key using the `python manage.py generate_fernet_key` command. Keep in mind that the fernet key plays a huge role in the api key authentication system.
```python
-DRF_API_KEY = {
+SIMPLE_API_KEY = {
"FERNET_SECRET": "sVjomf7FFy351xRxDeJWFJAZaE2tG3MTuUv92TLFfOA="
}
```
@@ -79,16 +78,15 @@ In your view then, you can add the authentication class and the permission class
```python
from rest_framework import viewsets
-from drf_apikey.backends import APIKeyAuthentication
+from rest_framework_simple_api_key.backends import APIKeyAuthentication
from rest_framework.response import Response
-
class FruitViewSets(viewsets.ViewSet):
- http_method_names = ["get"]
- authentication_classes = (APIKeyAuthentication,)
+ http_method_names = ["get"]
+ authentication_classes = (APIKeyAuthentication, )
- def list(self, request):
- return Response([{"detail": True}], 200)
+ def list(self, request):
+ return Response([{"detail": True}], 200 )
```
## Generate a Fernet Key
@@ -120,7 +118,7 @@ python manage.py runserver
## Changelog
-See [CHANGELOG.md](https://github.com/koladev32/drf-apikey/blob/main/CHANGELOG.md).
+See [CHANGELOG.md](https://github.com/koladev32/djangorestframework-simple-apikey/blob/main/CHANGELOG.md).
## Contributing
@@ -128,7 +126,7 @@ Thank you for your interest in contributing to the project! Here's a guide to he
- **Setup Development Environment:**
```bash
- git clone https://github.com/koladev32/drf-apikey.git
+ git clone https://github.com/koladev32/djangorestframework-simple-apikey.git
```
Use the command below to set up your environment:
```
@@ -159,4 +157,4 @@ Thank you for your interest in contributing to the project! Here's a guide to he
make test
```
-See [CONTRIBUTING.md](https://github.com/koladev32/drf-apikey/blob/main/CONTRIBUTING.md).
\ No newline at end of file
+See [CONTRIBUTING.md](https://github.com/koladev32/djangorestframework-simple-apikey/blob/main/CONTRIBUTING.md).
\ No newline at end of file
diff --git a/docs/analytics.rst b/docs/analytics.rst
index ea7542e..09539a7 100644
--- a/docs/analytics.rst
+++ b/docs/analytics.rst
@@ -2,7 +2,7 @@
API Key Analytics Middleware
======================
-The API Key Analytics Middleware is a component of the `drf-apikey` package that provides
+The API Key Analytics Middleware is a component of the `rest_framework_simple_api_key` package that provides
real-time analytics on API key usage. It records each API request, tracking which endpoints are accessed and how frequently.
API Key Analytics Middleware Usage cases
@@ -31,7 +31,7 @@ Setup
To use the `ApiKeyAnalyticsMiddleware`, follow these setup instructions:
-1. Ensure the middleware app `drf-apikey.analytics` is included in the ``INSTALLED_APPS`` setting
+1. Ensure the middleware app `rest_framework_simple_api_key.analytics` is included in the ``INSTALLED_APPS`` setting
of your Django project.
.. code-block:: python
@@ -39,8 +39,8 @@ To use the `ApiKeyAnalyticsMiddleware`, follow these setup instructions:
INSTALLED_APPS = (
...
"rest_framework",
- "drf-apikey",
- "drf-apikey.analytics", # Ensure this app is added
+ "rest_framework_simple_api_key",
+ "rest_framework_simple_api_key.analytics", # Ensure this app is added
)
2. Add the `ApiKeyAnalyticsMiddleware` to the `MIDDLEWARE` settings in your Django configuration.
@@ -50,7 +50,7 @@ To use the `ApiKeyAnalyticsMiddleware`, follow these setup instructions:
MIDDLEWARE = [
...
'django.middleware.security.SecurityMiddleware',
- 'drf-apikey.analytics.middleware.ApiKeyAnalyticsMiddleware', # Add the middleware here
+ 'rest_framework_simple_api_key.analytics.middleware.ApiKeyAnalyticsMiddleware', # Add the middleware here
...
]
@@ -58,7 +58,7 @@ To use the `ApiKeyAnalyticsMiddleware`, follow these setup instructions:
.. code-block:: shell
- python manage.py migrate drf-apikey_analytics
+ python manage.py migrate rest_framework_simple_api_key_analytics
Activation
----------
diff --git a/docs/authentication.rst b/docs/authentication.rst
index afb7355..bd30098 100644
--- a/docs/authentication.rst
+++ b/docs/authentication.rst
@@ -13,7 +13,7 @@ Key at ``request.user`` too.
solutions to have something such as ``request.entity`` without having
to disrupt the Django REST Framework authentication and authorization
flow. If you have some ideas, feel free to open an issue
- https://github.com/koladev32/drf-apikey/issues.
+ https://github.com/koladev32/djangorestframework-simple-apikey/issues.
Use the ``APIKeyAuthentication`` backend
----------------------------------------
@@ -36,10 +36,10 @@ you can modify in the ``settings.py`` file of your Django project.
.. code:: python
- DRF_API_KEY = {
+ SIMPLE_API_KEY = {
...
"AUTHENTICATION_KEYWORD_HEADER": "YOUR_CUSTOM_VALUE",
}
Feel free to read the code of the authentication class at
-https://github.com/koladev32/drf-apikey/blob/main/drf-apikey/backends.py.
+https://github.com/koladev32/djangorestframework-simple-apikey/blob/main/rest_framework_simple_api_key/backends.py.
diff --git a/docs/customizing_api_key_model.rst b/docs/customizing_api_key_model.rst
index 5fc1436..876102b 100644
--- a/docs/customizing_api_key_model.rst
+++ b/docs/customizing_api_key_model.rst
@@ -9,7 +9,7 @@ example using a custom class called ``Organization``.
# organizations/models.py
from django.db import models
- from drf-apikey.models import AbstractAPIKey
+ from rest_framework_simple_api_key.models import AbstractAPIKey
class Organization(models.Model):
name = models.CharField(max_length=255)
diff --git a/docs/getting_started.rst b/docs/getting_started.rst
index c3315e9..628835c 100644
--- a/docs/getting_started.rst
+++ b/docs/getting_started.rst
@@ -35,7 +35,7 @@ Why should you use this package for your API Key authentication?
permissions classes can be rewritten and fit your needs. We do our
best to extend Django classes and methods, so you can easily extend
our classes and methods.😉 Your Api Key authentication settings are
- kept in a single configuration dictionary named ``DRF_API_KEY`` in
+ kept in a single configuration dictionary named ``SIMPLE_API_KEY`` in
the ``settings.py`` file of your Django project. It can be customized
to fit your project needs.
@@ -46,7 +46,7 @@ Quickstart
.. code:: bash
- pip install drf-apikey
+ pip install djangorestframework-simple-apikey
2 - Register the app in the ``INSTALLED_APPS`` in the ``settings.py``
file:
@@ -58,17 +58,17 @@ file:
INSTALLED_APPS = [
# ...
"rest_framework",
- "drf-apikey",
+ "rest_framework_simple_api_key",
]
-3- Add the ``FERNET_KEY`` setting in your ``DRF_API_KEY``
+3- Add the ``FERNET_KEY`` setting in your ``SIMPLE_API_KEY``
configuration dictionary. You can easily generate a fernet key using the
``python manage.py generate_fernet_key`` command. Keep in mind that the
fernet key plays a huge role in the api key authentication system.
.. code:: python
- DRF_API_KEY = {
+ SIMPLE_API_KEY = {
"FERNET_SECRET": "sVjomf7FFy351xRxDeJWFJAZaE2tG3MTuUv92TLFfOA="
}
@@ -88,7 +88,7 @@ permission class.
from rest_framework import viewsets
- from drf-apikey.backends import APIKeyAuthentication
+ from rest_framework_simple_api_key.backends import APIKeyAuthentication
from rest_framework.response import Response
class FruitViewSets(viewsets.ViewSet):
@@ -119,10 +119,10 @@ Changelog
---------
See
-`CHANGELOG.md `__.
+`CHANGELOG.md `__.
Contributing
------------
See
-`CONTRIBUTING.md `__.
\ No newline at end of file
+`CONTRIBUTING.md `__.
\ No newline at end of file
diff --git a/docs/index.rst b/docs/index.rst
index 441190c..d57ca71 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -1,13 +1,13 @@
Django REST Simple Api Key
==========
-.. image:: https://badge.fury.io/py/drf-apikey.svg/
- :target: https://github.com/koladev32/drf-apikey/
+.. image:: https://badge.fury.io/py/djangorestframework-simple-apikey.svg/
+ :target: https://github.com/koladev32/djangorestframework-simple-apikey/
-.. image:: https://github.com/koladev32/drf-apikey/actions/workflows/ci-cd.yml/badge.svg/
- :target: https://github.com/koladev32/drf-apikey/actions/workflows/ci-cd.yml/
+.. image:: https://github.com/koladev32/djangorestframework-simple-apikey/actions/workflows/ci-cd.yml/badge.svg/
+ :target: https://github.com/koladev32/djangorestframework-simple-apikey/actions/workflows/ci-cd.yml/
-.. image:: https://readthedocs.org/projects/drf-apikey/badge/?version=latest
+.. image:: https://readthedocs.org/projects/djangorestframework-simple-apikey/badge/?version=latest
:target: https://djangorestframework-simple-apikey.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status
diff --git a/docs/permissions.rst b/docs/permissions.rst
index 001fdb2..863f4ae 100644
--- a/docs/permissions.rst
+++ b/docs/permissions.rst
@@ -31,7 +31,7 @@ You can then call use this class in your view 👇
.. code:: python
- from drf-apikey.permissions import IsActiveEntity
+ from rest_framework_simple_api_key.permissions import IsActiveEntity
class YourViewSet(viewsets.ViewSet):
...
@@ -39,4 +39,4 @@ You can then call use this class in your view 👇
permission_classes = (IsActiveEntity, )
Feel free to read the code of the permission class at
-`https://github.com/koladev32/drf-apikey/blob/main/drf-apikey/permissions.py `__.
\ No newline at end of file
+`https://github.com/koladev32/djangorestframework-simple-apikey/blob/main/rest_framework_simple_api_key/permissions.py `__.
\ No newline at end of file
diff --git a/docs/rotation.rst b/docs/rotation.rst
index 362152f..2f31963 100644
--- a/docs/rotation.rst
+++ b/docs/rotation.rst
@@ -13,7 +13,7 @@ project using the package, detailing the inner workings of the rotation process.
Key Rotation Overview
---------------------
-API Key Rotation in the `drf-apikey` package involves periodically
+API Key Rotation in the `rest_framework_simple_api_key` package involves periodically
changing the encryption keys used to secure API keys. During rotation, a new key is introduced,
and both the old and new keys are used for a transition period. This ensures that existing API
keys remain valid while new keys are encrypted with the fresh key.
@@ -23,22 +23,22 @@ Activation
Before activating a rotation, ensure to set the rotating Fernet key ``ROTATION_FERNET_SECRET`` in the settings of the package.
-You will need to add the rotation app ``drf-apikey.rotation`` in the ``INSTALLED_APPS`` Django setting of your project.
+You will need to add the rotation app ``rest_framework_simple_api_key.rotation`` in the ``INSTALLED_APPS`` Django setting of your project.
.. code-block:: python
INSTALLED_APPS=(
...
"rest_framework",
- "drf-apikey",
- "drf-apikey.rotation", # added app
+ "rest_framework_simple_api_key",
+ "rest_framework_simple_api_key.rotation", # added app
)
And you will need to run the migrate command:
.. code-block:: shell
- python manage.py migrate drf-apikey_rotation
+ python manage.py migrate rest_framework_simple_api_key_rotation
To activate API Key Rotation, you can choose one of the following methods:
diff --git a/docs/settings.rst b/docs/settings.rst
index 3e175f2..9b521aa 100644
--- a/docs/settings.rst
+++ b/docs/settings.rst
@@ -2,14 +2,14 @@ Settings
===========
Some of Django REST Framework Simple API Key's behavior can be customized through settings variables in
-``settings.py``. You can find below the default `DRF_API_KEY` setting.
+``settings.py``. You can find below the default `SIMPLE_API_KEY` setting.
.. code-block:: python
# Django project settings.py
...
- DRF_API_KEY = {
+ SIMPLE_API_KEY = {
"FERNET_SECRET": "",
"API_KEY_LIFETIME": 365,
"AUTHENTICATION_KEYWORD_HEADER": "Api-Key",
diff --git a/drf_apikey/version.py b/drf_apikey/version.py
deleted file mode 100644
index 2101409..0000000
--- a/drf_apikey/version.py
+++ /dev/null
@@ -1 +0,0 @@
-VERSION = "2.0.0"
diff --git a/example/ApiKey/settings.py b/example/ApiKey/settings.py
index 05c3d05..fd9de28 100644
--- a/example/ApiKey/settings.py
+++ b/example/ApiKey/settings.py
@@ -38,7 +38,7 @@
"django.contrib.messages",
"django.contrib.staticfiles",
"rest_framework",
- "drf_apikey",
+ "rest_framework_simple_api_key",
"fruits",
]
@@ -126,4 +126,4 @@
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
-DRF_API_KEY = {"FERNET_SECRET": "foo"}
+SIMPLE_API_KEY = {"FERNET_SECRET": "foo"}
diff --git a/example/fruits/viewsets.py b/example/fruits/viewsets.py
index 28f3414..61a9316 100644
--- a/example/fruits/viewsets.py
+++ b/example/fruits/viewsets.py
@@ -2,8 +2,8 @@
from rest_framework import viewsets
-from drf_apikey.backends import APIKeyAuthentication
-from drf_apikey.permissions import IsActiveEntity
+from rest_framework_simple_api_key.backends import APIKeyAuthentication
+from rest_framework_simple_api_key.permissions import IsActiveEntity
from rest_framework.response import Response
diff --git a/example/requirements.txt b/example/requirements.txt
index 2084405..83cbe3d 100644
--- a/example/requirements.txt
+++ b/example/requirements.txt
@@ -1,3 +1,3 @@
Django==4.1.6
djangorestframework==3.14.0
-drf-apikey==0.1.2
+djangorestframework-simple-apikey==0.1.2
diff --git a/pyproject.toml b/pyproject.toml
index 7077c8e..09859ad 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -5,6 +5,6 @@ requires = ["setuptools>=61.0.0", "wheel"]
build-backend = "setuptools.build_meta"
[project]
-name = "drf-apikey"
-version = "2.0.0"
+name = "djangorestframework-simple-apikey"
+version = "1.1.1"
dynamic = ["description", "readme", "optional-dependencies", "dependencies", "classifiers", "authors", "license"]
\ No newline at end of file
diff --git a/drf_apikey/__init__.py b/rest_framework_simple_api_key/__init__.py
similarity index 87%
rename from drf_apikey/__init__.py
rename to rest_framework_simple_api_key/__init__.py
index 1ed2a96..d8a7593 100644
--- a/drf_apikey/__init__.py
+++ b/rest_framework_simple_api_key/__init__.py
@@ -9,7 +9,7 @@
warnings.warn(
"This package, 'djangorestframework-simple-apikey', has been renamed to 'drf-apikey' and will no longer be updated."
"Please switch to the new package to continue receiving updates and support. "
- "For more information and migration instructions, please visit: https://djangorestframework-simple-apikey.readthedocs.io/en/latest/migrating.html",
+ "For more information and migration instructions, please visit: https://drf-apikey.readthedocs.io/en/latest/migrating.html",
DeprecationWarning,
stacklevel=2,
)
diff --git a/drf_apikey/admin.py b/rest_framework_simple_api_key/admin.py
similarity index 100%
rename from drf_apikey/admin.py
rename to rest_framework_simple_api_key/admin.py
diff --git a/drf_apikey/analytics/__init__.py b/rest_framework_simple_api_key/analytics/__init__.py
similarity index 100%
rename from drf_apikey/analytics/__init__.py
rename to rest_framework_simple_api_key/analytics/__init__.py
diff --git a/drf_apikey/analytics/admin.py b/rest_framework_simple_api_key/analytics/admin.py
similarity index 100%
rename from drf_apikey/analytics/admin.py
rename to rest_framework_simple_api_key/analytics/admin.py
diff --git a/drf_apikey/analytics/apps.py b/rest_framework_simple_api_key/analytics/apps.py
similarity index 54%
rename from drf_apikey/analytics/apps.py
rename to rest_framework_simple_api_key/analytics/apps.py
index 521839a..964e302 100644
--- a/drf_apikey/analytics/apps.py
+++ b/rest_framework_simple_api_key/analytics/apps.py
@@ -3,5 +3,5 @@
class AnalyticsConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
- name = "drf_apikey.analytics"
- label = "drf_apikey_analytics"
+ name = "rest_framework_simple_api_key.analytics"
+ label = "rest_framework_simple_api_key_analytics"
diff --git a/drf_apikey/analytics/middleware.py b/rest_framework_simple_api_key/analytics/middleware.py
similarity index 70%
rename from drf_apikey/analytics/middleware.py
rename to rest_framework_simple_api_key/analytics/middleware.py
index 4e397bc..cba06eb 100644
--- a/drf_apikey/analytics/middleware.py
+++ b/rest_framework_simple_api_key/analytics/middleware.py
@@ -1,7 +1,7 @@
-from drf_apikey.analytics.models import ApiKeyAnalytics
-from drf_apikey.crypto import get_crypto
-from drf_apikey.parser import APIKeyParser
-from drf_apikey.utils import get_key
+from rest_framework_simple_api_key.analytics.models import ApiKeyAnalytics
+from rest_framework_simple_api_key.crypto import get_crypto
+from rest_framework_simple_api_key.parser import APIKeyParser
+from rest_framework_simple_api_key.utils import get_key
class ApiKeyAnalyticsMiddleware:
diff --git a/drf_apikey/analytics/migrations/0001_initial.py b/rest_framework_simple_api_key/analytics/migrations/0001_initial.py
similarity index 88%
rename from drf_apikey/analytics/migrations/0001_initial.py
rename to rest_framework_simple_api_key/analytics/migrations/0001_initial.py
index 48687d2..7680c9f 100644
--- a/drf_apikey/analytics/migrations/0001_initial.py
+++ b/rest_framework_simple_api_key/analytics/migrations/0001_initial.py
@@ -9,7 +9,7 @@ class Migration(migrations.Migration):
initial = True
dependencies = [
- ("drf_apikey", "0002_alter_apikey_options"),
+ ("rest_framework_simple_api_key", "0002_alter_apikey_options"),
]
operations = [
@@ -32,7 +32,7 @@ class Migration(migrations.Migration):
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="analytics",
- to="drf_apikey.apikey",
+ to="rest_framework_simple_api_key.apikey",
),
),
],
diff --git a/drf_apikey/analytics/migrations/__init__.py b/rest_framework_simple_api_key/analytics/migrations/__init__.py
similarity index 100%
rename from drf_apikey/analytics/migrations/__init__.py
rename to rest_framework_simple_api_key/analytics/migrations/__init__.py
diff --git a/drf_apikey/analytics/models.py b/rest_framework_simple_api_key/analytics/models.py
similarity index 96%
rename from drf_apikey/analytics/models.py
rename to rest_framework_simple_api_key/analytics/models.py
index af62ae3..2fabdd3 100644
--- a/drf_apikey/analytics/models.py
+++ b/rest_framework_simple_api_key/analytics/models.py
@@ -1,5 +1,5 @@
from django.db import models
-from drf_apikey.settings import package_settings
+from rest_framework_simple_api_key.settings import package_settings
class ApiKeyAnalyticsManager(models.Manager):
diff --git a/drf_apikey/apps.py b/rest_framework_simple_api_key/apps.py
similarity index 74%
rename from drf_apikey/apps.py
rename to rest_framework_simple_api_key/apps.py
index d292ab8..ec4045a 100644
--- a/drf_apikey/apps.py
+++ b/rest_framework_simple_api_key/apps.py
@@ -2,5 +2,5 @@
class RestSimpleAPIKeyConfig(AppConfig):
- name = "drf_apikey"
+ name = "rest_framework_simple_api_key"
verbose_name = "Django REST simple API Key"
diff --git a/drf_apikey/backends.py b/rest_framework_simple_api_key/backends.py
similarity index 93%
rename from drf_apikey/backends.py
rename to rest_framework_simple_api_key/backends.py
index 1a226a3..797ef6e 100644
--- a/drf_apikey/backends.py
+++ b/rest_framework_simple_api_key/backends.py
@@ -8,9 +8,9 @@
from rest_framework import exceptions
-from drf_apikey.crypto import get_crypto
-from drf_apikey.models import APIKey
-from drf_apikey.parser import APIKeyParser
+from rest_framework_simple_api_key.crypto import get_crypto
+from rest_framework_simple_api_key.models import APIKey
+from rest_framework_simple_api_key.parser import APIKeyParser
class APIKeyAuthentication(BaseBackend):
diff --git a/drf_apikey/crypto.py b/rest_framework_simple_api_key/crypto.py
similarity index 90%
rename from drf_apikey/crypto.py
rename to rest_framework_simple_api_key/crypto.py
index 89c04fe..63010be 100644
--- a/drf_apikey/crypto.py
+++ b/rest_framework_simple_api_key/crypto.py
@@ -11,7 +11,7 @@
from django.utils.timezone import now
-from drf_apikey.settings import package_settings
+from rest_framework_simple_api_key.settings import package_settings
class BaseApiCrypto:
@@ -60,11 +60,11 @@ def __init__(self):
def get_crypto():
- if "drf_apikey.rotation" in settings.INSTALLED_APPS:
+ if "rest_framework_simple_api_key.rotation" in settings.INSTALLED_APPS:
try:
# Try to import necessary components and initialize the MultiApiCrypto.
# This might fail if certain conditions aren't met, like missing migrations.
- from drf_apikey.rotation.utils import get_rotation_status
+ from rest_framework_simple_api_key.rotation.utils import get_rotation_status
from .mutli_api_crypto import MultiApiCrypto
if get_rotation_status():
diff --git a/drf_apikey/management/__init__.py b/rest_framework_simple_api_key/management/__init__.py
similarity index 100%
rename from drf_apikey/management/__init__.py
rename to rest_framework_simple_api_key/management/__init__.py
diff --git a/drf_apikey/management/commands/__init__.py b/rest_framework_simple_api_key/management/commands/__init__.py
similarity index 100%
rename from drf_apikey/management/commands/__init__.py
rename to rest_framework_simple_api_key/management/commands/__init__.py
diff --git a/drf_apikey/management/commands/generate_fernet_key.py b/rest_framework_simple_api_key/management/commands/generate_fernet_key.py
similarity index 100%
rename from drf_apikey/management/commands/generate_fernet_key.py
rename to rest_framework_simple_api_key/management/commands/generate_fernet_key.py
diff --git a/drf_apikey/management/commands/rotation.py b/rest_framework_simple_api_key/management/commands/rotation.py
similarity index 91%
rename from drf_apikey/management/commands/rotation.py
rename to rest_framework_simple_api_key/management/commands/rotation.py
index 9845b30..40fdb17 100644
--- a/drf_apikey/management/commands/rotation.py
+++ b/rest_framework_simple_api_key/management/commands/rotation.py
@@ -3,8 +3,8 @@
from django.core.management.base import BaseCommand, CommandError
from django.utils import timezone
-from drf_apikey.rotation.models import Rotation
-from drf_apikey.settings import package_settings
+from rest_framework_simple_api_key.rotation.models import Rotation
+from rest_framework_simple_api_key.settings import package_settings
class Command(BaseCommand):
diff --git a/drf_apikey/migrations/0001_initial.py b/rest_framework_simple_api_key/migrations/0001_initial.py
similarity index 93%
rename from drf_apikey/migrations/0001_initial.py
rename to rest_framework_simple_api_key/migrations/0001_initial.py
index d8fe8c9..68ac96d 100644
--- a/drf_apikey/migrations/0001_initial.py
+++ b/rest_framework_simple_api_key/migrations/0001_initial.py
@@ -3,7 +3,7 @@
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
-import drf_apikey.models
+import rest_framework_simple_api_key.models
class Migration(migrations.Migration):
@@ -30,7 +30,7 @@ class Migration(migrations.Migration):
(
"expiry_date",
models.DateTimeField(
- default=drf_apikey.models._expiry_date,
+ default=rest_framework_simple_api_key.models._expiry_date,
help_text="Once API key expires, entities cannot use it anymore.",
verbose_name="Expires",
),
diff --git a/drf_apikey/migrations/0002_alter_apikey_options.py b/rest_framework_simple_api_key/migrations/0002_alter_apikey_options.py
similarity index 85%
rename from drf_apikey/migrations/0002_alter_apikey_options.py
rename to rest_framework_simple_api_key/migrations/0002_alter_apikey_options.py
index 599e8a5..a925fc9 100644
--- a/drf_apikey/migrations/0002_alter_apikey_options.py
+++ b/rest_framework_simple_api_key/migrations/0002_alter_apikey_options.py
@@ -5,7 +5,7 @@
class Migration(migrations.Migration):
dependencies = [
- ("drf_apikey", "0001_initial"),
+ ("rest_framework_simple_api_key", "0001_initial"),
]
operations = [
diff --git a/drf_apikey/migrations/__init__.py b/rest_framework_simple_api_key/migrations/__init__.py
similarity index 100%
rename from drf_apikey/migrations/__init__.py
rename to rest_framework_simple_api_key/migrations/__init__.py
diff --git a/drf_apikey/models.py b/rest_framework_simple_api_key/models.py
similarity index 94%
rename from drf_apikey/models.py
rename to rest_framework_simple_api_key/models.py
index 0ef11ce..d09db13 100644
--- a/drf_apikey/models.py
+++ b/rest_framework_simple_api_key/models.py
@@ -4,8 +4,8 @@
from django.conf import settings
from django.db import models
-from drf_apikey.crypto import get_crypto
-from drf_apikey.settings import package_settings
+from rest_framework_simple_api_key.crypto import get_crypto
+from rest_framework_simple_api_key.settings import package_settings
def _expiry_date():
diff --git a/drf_apikey/mutli_api_crypto.py b/rest_framework_simple_api_key/mutli_api_crypto.py
similarity index 85%
rename from drf_apikey/mutli_api_crypto.py
rename to rest_framework_simple_api_key/mutli_api_crypto.py
index e58c1ce..9fb1927 100644
--- a/drf_apikey/mutli_api_crypto.py
+++ b/rest_framework_simple_api_key/mutli_api_crypto.py
@@ -1,7 +1,7 @@
from cryptography.fernet import MultiFernet, Fernet
-from drf_apikey.crypto import BaseApiCrypto
-from drf_apikey.settings import package_settings
+from rest_framework_simple_api_key.crypto import BaseApiCrypto
+from rest_framework_simple_api_key.settings import package_settings
class MultiApiCrypto(BaseApiCrypto):
diff --git a/drf_apikey/parser.py b/rest_framework_simple_api_key/parser.py
similarity index 94%
rename from drf_apikey/parser.py
rename to rest_framework_simple_api_key/parser.py
index a18ac37..8123e41 100644
--- a/drf_apikey/parser.py
+++ b/rest_framework_simple_api_key/parser.py
@@ -3,7 +3,7 @@
from django.http import HttpRequest
from rest_framework.exceptions import NotAuthenticated, AuthenticationFailed
-from drf_apikey.settings import package_settings
+from rest_framework_simple_api_key.settings import package_settings
class APIKeyParser:
diff --git a/drf_apikey/permissions.py b/rest_framework_simple_api_key/permissions.py
similarity index 100%
rename from drf_apikey/permissions.py
rename to rest_framework_simple_api_key/permissions.py
diff --git a/drf_apikey/rotation/__init__.py b/rest_framework_simple_api_key/rotation/__init__.py
similarity index 100%
rename from drf_apikey/rotation/__init__.py
rename to rest_framework_simple_api_key/rotation/__init__.py
diff --git a/drf_apikey/rotation/admin.py b/rest_framework_simple_api_key/rotation/admin.py
similarity index 100%
rename from drf_apikey/rotation/admin.py
rename to rest_framework_simple_api_key/rotation/admin.py
diff --git a/drf_apikey/rotation/apps.py b/rest_framework_simple_api_key/rotation/apps.py
similarity index 54%
rename from drf_apikey/rotation/apps.py
rename to rest_framework_simple_api_key/rotation/apps.py
index 68caab9..90d5c75 100644
--- a/drf_apikey/rotation/apps.py
+++ b/rest_framework_simple_api_key/rotation/apps.py
@@ -3,5 +3,5 @@
class RotationConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
- name = "drf_apikey.rotation"
- label = "drf_apikey_rotation"
+ name = "rest_framework_simple_api_key.rotation"
+ label = "rest_framework_simple_api_key_rotation"
diff --git a/drf_apikey/rotation/migrations/0001_initial.py b/rest_framework_simple_api_key/rotation/migrations/0001_initial.py
similarity index 100%
rename from drf_apikey/rotation/migrations/0001_initial.py
rename to rest_framework_simple_api_key/rotation/migrations/0001_initial.py
diff --git a/drf_apikey/rotation/migrations/__init__.py b/rest_framework_simple_api_key/rotation/migrations/__init__.py
similarity index 100%
rename from drf_apikey/rotation/migrations/__init__.py
rename to rest_framework_simple_api_key/rotation/migrations/__init__.py
diff --git a/drf_apikey/rotation/models.py b/rest_framework_simple_api_key/rotation/models.py
similarity index 100%
rename from drf_apikey/rotation/models.py
rename to rest_framework_simple_api_key/rotation/models.py
diff --git a/drf_apikey/rotation/utils.py b/rest_framework_simple_api_key/rotation/utils.py
similarity index 88%
rename from drf_apikey/rotation/utils.py
rename to rest_framework_simple_api_key/rotation/utils.py
index 03a7277..5e8b8ce 100644
--- a/drf_apikey/rotation/utils.py
+++ b/rest_framework_simple_api_key/rotation/utils.py
@@ -2,7 +2,7 @@
from django.apps import apps
from django.utils import timezone
-from drf_apikey.settings import package_settings
+from rest_framework_simple_api_key.settings import package_settings
def get_rotation_status():
@@ -12,7 +12,7 @@ def get_rotation_status():
rotation_status is None
): # We should check for 'None' specifically because the cached value could be False
# Lazy load the Rotation model
- Rotation = apps.get_model("drf_apikey_rotation", "Rotation")
+ Rotation = apps.get_model("rest_framework_simple_api_key_rotation", "Rotation")
# Filter the latest rotation that is enabled
config = (
diff --git a/drf_apikey/settings.py b/rest_framework_simple_api_key/settings.py
similarity index 81%
rename from drf_apikey/settings.py
rename to rest_framework_simple_api_key/settings.py
index 23cfaee..19c9e77 100644
--- a/drf_apikey/settings.py
+++ b/rest_framework_simple_api_key/settings.py
@@ -6,7 +6,7 @@
from django.utils.translation import gettext_lazy as _
from rest_framework.settings import APISettings as _APISettings
-USER_SETTINGS = getattr(settings, "DRF_API_KEY", None)
+USER_SETTINGS = getattr(settings, "SIMPLE_API_KEY", None)
DEFAULTS = {
"FERNET_SECRET": "",
@@ -14,7 +14,7 @@
"API_KEY_LIFETIME": 365,
"AUTHENTICATION_KEYWORD_HEADER": "Api-Key",
"ROTATION_PERIOD": timedelta(days=7),
- "API_KEY_CLASS": "drf_apikey.Apikey",
+ "API_KEY_CLASS": "rest_framework_simple_api_key.Apikey",
}
REMOVED_SETTINGS = ()
@@ -24,11 +24,11 @@ class PackageSettings(_APISettings):
@property
def user_settings(self):
if not hasattr(self, "_user_settings"):
- self._user_settings = getattr(settings, "DRF_API_KEY", {})
+ self._user_settings = getattr(settings, "SIMPLE_API_KEY", {})
return self._user_settings
def __check_user_settings(self, user_settings):
- SETTINGS_DOC = "https://djangorestframework-simple-apikey.readthedocs.io/en/latest/settings.html"
+ SETTINGS_DOC = "https://django-rest-framework-simple-apikey.readthedocs.io/en/latest/settings.html"
for setting in REMOVED_SETTINGS:
if setting in user_settings:
@@ -53,7 +53,7 @@ def reload_api_settings(*args, **kwargs):
setting, value = kwargs["setting"], kwargs["value"]
- if setting == "DRF_API_KEY":
+ if setting == "SIMPLE_API_KEY":
package_settings = PackageSettings(value, DEFAULTS)
diff --git a/drf_apikey/utils.py b/rest_framework_simple_api_key/utils.py
similarity index 100%
rename from drf_apikey/utils.py
rename to rest_framework_simple_api_key/utils.py
diff --git a/rest_framework_simple_api_key/version.py b/rest_framework_simple_api_key/version.py
new file mode 100644
index 0000000..ca638cf
--- /dev/null
+++ b/rest_framework_simple_api_key/version.py
@@ -0,0 +1 @@
+VERSION = "1.1.1"
diff --git a/scripts/makemigrations.py b/scripts/makemigrations.py
index 34197f0..6ff023e 100644
--- a/scripts/makemigrations.py
+++ b/scripts/makemigrations.py
@@ -21,9 +21,9 @@
"django.contrib.sites",
"django.contrib.staticfiles",
"rest_framework",
- "drf_apikey",
- "drf_apikey.rotation",
- "drf_apikey.analytics",
+ "rest_framework_simple_api_key",
+ "rest_framework_simple_api_key.rotation",
+ "rest_framework_simple_api_key.analytics",
"tests",
),
DATABASES={
@@ -32,7 +32,7 @@
"NAME": ":memory:",
}
},
- DRF_API_KEY={
+ SIMPLE_API_KEY={
"FERNET_SECRET": "sVjomf7FFy351xRxDeJWFJAZaE2tG3MTuUv92TLFfOA=",
},
)
diff --git a/setup.cfg b/setup.cfg
index d6c884d..4932fb0 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,5 +1,5 @@
[bumpversion]
-current_version = 2.0.0
+current_version = 1.1.1
commit = True
tag = True
@@ -7,7 +7,7 @@ tag = True
search = version = "{current_version}"
replace = version = "{new_version}"
-[bumpversion:file:drf_apikey/version.py]
+[bumpversion:file:rest_framework_simple_api_key/version.py]
search = VERSION = "{current_version}"
replace = VERSION = "{new_version}"
@@ -26,9 +26,9 @@ replace =
universal = 1
[metadata]
-name = drf-apikey
+name = djangorestframework-simple-apikey
version = "{current_version}"
-url = https://github.com/koladev32/drf-apikey
+url = https://github.com/koladev32/djangorestframework-simple-apikey
license = MIT
author = Kolawole Mangabo
author_email = onaelmangabo@gmail.com
diff --git a/tests/conftest.py b/tests/conftest.py
index eb88f88..aee85b6 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -11,7 +11,7 @@ def pytest_configure():
"django.contrib.sessions.middleware.SessionMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
- "drf_apikey.analytics.middleware.ApiKeyAnalyticsMiddleware",
+ "rest_framework_simple_api_key.analytics.middleware.ApiKeyAnalyticsMiddleware",
)
apps = [
@@ -22,13 +22,13 @@ def pytest_configure():
"django.contrib.sites",
"django.contrib.staticfiles",
"rest_framework",
- "drf_apikey",
- "drf_apikey.analytics",
+ "rest_framework_simple_api_key",
+ "rest_framework_simple_api_key.analytics",
"tests",
]
if os.environ.get("TEST_WITH_ROTATION"):
- apps.append("drf_apikey.rotation")
+ apps.append("rest_framework_simple_api_key.rotation")
settings.configure(
DEBUG_PROPAGATE_EXCEPTIONS=True,
@@ -50,7 +50,7 @@ def pytest_configure():
MIDDLEWARE_CLASSES=MIDDLEWARE,
INSTALLED_APPS=apps,
PASSWORD_HASHERS=("django.contrib.auth.hashers.MD5PasswordHasher",),
- DRF_API_KEY={
+ SIMPLE_API_KEY={
"FERNET_SECRET": "sVjomf7FFy351xRxDeJWFJAZaE2tG3MTuUv92TLFfOA=",
"ROTATION_FERNET_SECRET": "EqkeOOgvV8bt70vUJiVXloNycn5bt_z1VqyoAi9K6f4=",
},
@@ -69,7 +69,7 @@ def setup_rotation_config(db):
from django.conf import settings
"""Ensure a RotationConfig object exists for tests."""
- if "drf_apikey.rotation" in settings.INSTALLED_APPS:
- from drf_apikey.rotation.models import Rotation
+ if "rest_framework_simple_api_key.rotation" in settings.INSTALLED_APPS:
+ from rest_framework_simple_api_key.rotation.models import Rotation
Rotation.objects.create(is_rotation_enabled=True)
diff --git a/tests/fixtures/api_key.py b/tests/fixtures/api_key.py
index 9e3e0cc..1d74d09 100644
--- a/tests/fixtures/api_key.py
+++ b/tests/fixtures/api_key.py
@@ -1,7 +1,7 @@
import pytest
from django.utils.timezone import now
-from drf_apikey.models import APIKey
+from rest_framework_simple_api_key.models import APIKey
from .user import user, inactive_user
diff --git a/tests/test_admin.py b/tests/test_admin.py
index 07634c6..cf2b5a6 100644
--- a/tests/test_admin.py
+++ b/tests/test_admin.py
@@ -7,8 +7,8 @@
from django.http.response import HttpResponse
from django.test import RequestFactory
-from drf_apikey.admin import ApiKeyAdmin
-from drf_apikey.models import APIKey
+from rest_framework_simple_api_key.admin import ApiKeyAdmin
+from rest_framework_simple_api_key.models import APIKey
from .fixtures.user import user
diff --git a/tests/test_analytics.py b/tests/test_analytics.py
index 111130d..7f08731 100644
--- a/tests/test_analytics.py
+++ b/tests/test_analytics.py
@@ -1,5 +1,5 @@
import pytest
-from drf_apikey.analytics.models import ApiKeyAnalytics
+from rest_framework_simple_api_key.analytics.models import ApiKeyAnalytics
from .fixtures.api_key import active_only_api_key
from .fixtures.user import user
diff --git a/tests/test_analytics_middleware.py b/tests/test_analytics_middleware.py
index 5c0f49a..75fd5a6 100644
--- a/tests/test_analytics_middleware.py
+++ b/tests/test_analytics_middleware.py
@@ -3,8 +3,8 @@
import pytest
from django.http import HttpResponse
from django.test import RequestFactory
-from drf_apikey.analytics.middleware import ApiKeyAnalyticsMiddleware
-from drf_apikey.analytics.models import ApiKeyAnalytics
+from rest_framework_simple_api_key.analytics.middleware import ApiKeyAnalyticsMiddleware
+from rest_framework_simple_api_key.analytics.models import ApiKeyAnalytics
from .fixtures.api_key import active_api_key
from .fixtures.user import user
@@ -36,9 +36,9 @@ def test_api_key_analytics_middleware(
# Assume get_key and get_crypto are properly mocked to return expected values
with mock.patch(
- "drf_apikey.parser.APIKeyParser.get", return_value=key
+ "rest_framework_simple_api_key.parser.APIKeyParser.get", return_value=key
), mock.patch(
- "drf_apikey.crypto.ApiCrypto.decrypt",
+ "rest_framework_simple_api_key.crypto.ApiCrypto.decrypt",
return_value={"_pk": apikey.pk},
):
# Call middleware
diff --git a/tests/test_api_authentication.py b/tests/test_api_authentication.py
index ec9308a..56779c8 100644
--- a/tests/test_api_authentication.py
+++ b/tests/test_api_authentication.py
@@ -5,7 +5,7 @@
from rest_framework.test import APIRequestFactory
-from drf_apikey.settings import package_settings
+from rest_framework_simple_api_key.settings import package_settings
from .fixtures.user import user
from .fixtures.api_key import expired_api_key, active_api_key, revoked_api_key
@@ -54,7 +54,7 @@ def valid_request(user, active_api_key):
def api_key_authentication():
- from drf_apikey.backends import APIKeyAuthentication
+ from rest_framework_simple_api_key.backends import APIKeyAuthentication
return APIKeyAuthentication()
diff --git a/tests/test_api_key_crypto.py b/tests/test_api_key_crypto.py
index f2ad5c8..f5f97d9 100644
--- a/tests/test_api_key_crypto.py
+++ b/tests/test_api_key_crypto.py
@@ -4,7 +4,7 @@
def key_crypto():
- from drf_apikey.crypto import get_crypto
+ from rest_framework_simple_api_key.crypto import get_crypto
return get_crypto()
diff --git a/tests/test_api_key_multi_crypto.py b/tests/test_api_key_multi_crypto.py
index 3dc5fe3..2768cee 100644
--- a/tests/test_api_key_multi_crypto.py
+++ b/tests/test_api_key_multi_crypto.py
@@ -3,15 +3,15 @@
import pytest
-from drf_apikey.crypto import ApiCrypto
-from drf_apikey.mutli_api_crypto import MultiApiCrypto
+from rest_framework_simple_api_key.crypto import ApiCrypto
+from rest_framework_simple_api_key.mutli_api_crypto import MultiApiCrypto
@pytest.mark.django_db
class TestCryptoFunctions:
@pytest.fixture(scope="class")
def key_crypto(self):
- from drf_apikey.crypto import get_crypto
+ from rest_framework_simple_api_key.crypto import get_crypto
return get_crypto()
diff --git a/tests/test_models.py b/tests/test_models.py
index 0505e0c..08be284 100644
--- a/tests/test_models.py
+++ b/tests/test_models.py
@@ -1,6 +1,6 @@
import pytest
-from drf_apikey.models import APIKey
+from rest_framework_simple_api_key.models import APIKey
from .fixtures.user import user
from .fixtures.api_key import active_api_key
diff --git a/tests/test_permissions.py b/tests/test_permissions.py
index c7e9832..b88dc9d 100644
--- a/tests/test_permissions.py
+++ b/tests/test_permissions.py
@@ -10,9 +10,9 @@
from rest_framework.test import APIRequestFactory
-from drf_apikey.backends import APIKeyAuthentication
-from drf_apikey.permissions import IsActiveEntity
-from drf_apikey.settings import package_settings
+from rest_framework_simple_api_key.backends import APIKeyAuthentication
+from rest_framework_simple_api_key.permissions import IsActiveEntity
+from rest_framework_simple_api_key.settings import package_settings
from .fixtures.api_key import inactive_entity_api_key, active_api_key
from .fixtures.user import inactive_user, user