Skip to content

Commit c7ee5f4

Browse files
authored
tests/contrib/django: use a longer password (#2586)
Some updates to the base FIPS image (I guess) started enforcing a required longer password: > return hashlib.pbkdf2_hmac(digest().name, password, salt, iterations, dklen) E ValueError: [Provider routines] invalid key length
1 parent 52058ba commit c7ee5f4

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tests/contrib/django/django_tests.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def test_view_exception_elasticapm_debug(django_elasticapm_client, client):
172172
@pytest.mark.django_db
173173
def test_user_info(django_elasticapm_client, client):
174174
user = User(username="admin", email="admin@example.com")
175-
user.set_password("admin")
175+
user.set_password("longer_password_for_admin")
176176
user.save()
177177

178178
with pytest.raises(Exception):
@@ -187,7 +187,7 @@ def test_user_info(django_elasticapm_client, client):
187187
assert user_info["username"] == ""
188188
assert "email" not in user_info
189189

190-
assert client.login(username="admin", password="admin")
190+
assert client.login(username="admin", password="longer_password_for_admin")
191191

192192
with pytest.raises(Exception):
193193
client.get(reverse("elasticapm-raise-exc"))
@@ -207,10 +207,10 @@ def test_user_info(django_elasticapm_client, client):
207207
@pytest.mark.django_db
208208
def test_user_info_raises_database_error(django_elasticapm_client, client):
209209
user = User(username="admin", email="admin@example.com")
210-
user.set_password("admin")
210+
user.set_password("longer_password_for_admin")
211211
user.save()
212212

213-
assert client.login(username="admin", password="admin")
213+
assert client.login(username="admin", password="longer_password_for_admin")
214214

215215
with mock.patch("django.contrib.auth.models.User.is_authenticated") as is_authenticated:
216216
is_authenticated.side_effect = DatabaseError("Test Exception")
@@ -231,9 +231,9 @@ def test_user_info_with_custom_user(django_elasticapm_client, client):
231231

232232
MyUser = get_user_model()
233233
user = MyUser(my_username="admin")
234-
user.set_password("admin")
234+
user.set_password("longer_password_for_admin")
235235
user.save()
236-
assert client.login(username="admin", password="admin")
236+
assert client.login(username="admin", password="longer_password_for_admin")
237237
with pytest.raises(Exception):
238238
client.get(reverse("elasticapm-raise-exc"))
239239

@@ -255,9 +255,9 @@ def test_user_info_with_custom_user_non_string_username(django_elasticapm_client
255255

256256
MyIntUser = get_user_model()
257257
user = MyIntUser(my_username=1)
258-
user.set_password("admin")
258+
user.set_password("longer_password_for_admin")
259259
user.save()
260-
assert client.login(username=1, password="admin")
260+
assert client.login(username=1, password="longer_password_for_admin")
261261
with pytest.raises(Exception):
262262
client.get(reverse("elasticapm-raise-exc"))
263263

0 commit comments

Comments
 (0)