Code Duplication    Length = 13-13 lines in 2 locations

tests/pipelines/test_password_reset_confirm.py 1 location

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

tests/pipelines/test_username_update.py 1 location

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