Code Duplication    Length = 13-13 lines in 2 locations

tests/pipelines/test_password_reset_confirm.py 1 location

@@ 50-62 (lines=13) @@
47
48
49
@pytest.mark.django_db(transaction=False)
50
def test_invalid_serialize_request_not_existent_user(test_user):
51
    request = mock.MagicMock()
52
    request.data = {
53
        'uid': utils.encode_uid(test_user.pk + 1),
54
        'token': default_token_generator.make_token(test_user),
55
        'new_password': 'whatever-123',
56
    }
57
    context = {'request': request}
58
    with pytest.raises(exceptions.ValidationError) as e:
59
        pipelines.password_reset_confirm.serialize_request(**context)
60
61
    assert e.value.errors == {
62
        'non_field_errors': [constants.INVALID_UID_ERROR]
63
    }
64
65

tests/pipelines/test_username_update.py 1 location

@@ 31-43 (lines=13) @@
28
29
30
@pytest.mark.django_db(transaction=False)
31
def test_invalid_serialize_request_same_username(test_user):
32
    request = mock.MagicMock()
33
    request.user = test_user
34
    request.data = {
35
        User.USERNAME_FIELD: getattr(test_user, User.USERNAME_FIELD),
36
        'current_password': 'testing123',
37
    }
38
    context = {'request': request}
39
    with pytest.raises(exceptions.ValidationError) as e:
40
        pipelines.username_update.serialize_request(**context)
41
42
    assert e.value.errors == {
43
        'username': ['A user with that username already exists.']
44
    }
45
46