Closed caioariede closed 3 years ago
File | Coverage | |
---|---|---|
All files | 95% |
:white_check_mark: |
anon/init.py | 63% |
:white_check_mark: |
anon/base.py | 97% |
:white_check_mark: |
anon/utils.py | 83% |
:white_check_mark: |
tests/compat.py | 50% |
:white_check_mark: |
tests/test_base.py | 99% |
:white_check_mark: |
Minimum allowed coverage is 50%
Generated by :monkey: cobertura-action against ecde51aef842b0a1f0b5ed2dcc9ea82cb281f76a
Description
Many times we call
anon.fake_email()
will result in an error:This happens because of two problems:
fake_text
function does not work well with short strings (< 14 chars). This is the length of the biggest word in the wordlist (see below), and it may causefake_text
to raise the exception above.https://github.com/Tesorio/django-anon/blob/7a02db68f22a8770d08f41692aba1c06b42560fb/anon/utils.py#L6-L10
fake_email
arefake_email(max_size=25, suffix="@example.com")
, which means there will be only12 chars
left to generate the first part of the address, as shown below:The first part (
aaaabbbbcccc
) is generated byfake_text
, as explained before, don't like short stringsSolution
This PR addresses:
fake_text
handle short stringsmax_size
infake_email
to40
, which islen("@example.com") + (_max_word_size * 2)
Todos