-
-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refatoração dos testes #79
Draft
thisiscleverson
wants to merge
5
commits into
okfn-brasil:main
Choose a base branch
from
thisiscleverson:refactor-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Legal! Normalmente PR em rascunho eu aguardo ficar pronto para revisar. Mas se quiser opinião sobre algo específico pode falar |
Bom, eu coloquei como draft pq eu não tenho muito xp com testes e gostaria de receber feedback sobre o PR — seja sobre a ideia, melhorias ou possíveis erros que precisam ser corrigidos ou testes que faltaram. |
- Coloquei anotações de tipo nos métodos. - Criei o método `_to_number` para converter string para número. Esse método é usado para substituir a conversão direta usando a função `int()`, pois usando esse método estava dando um erro no `test_load_configuration_with_empty_envvars` onde a função `int()` não conseguia converter a string vazia para número. Com isso, o método tenta converter para inteiro, mas se a String estiver vazia, com espaços ou se tiver letras, vai retornar o valor padrão passado pelo parâmetro do método.
- remoção do campo `QUERIDO_DIARIO_OPENSEARCH_INDEX`. - adição de novos asserts para verificar todas as variaveis de ambiente.
Fiz a refatoração do |
|
- adição de novos fakes no fake_database_data. - refatoração nos testes - novos casos de testes
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Refatorei os testes e os coloquei para funcionar novamente. Não adicionei muitos testes, pois foquei em corrigir e fazer os testes existentes funcionarem novamente.
Algumas coisas que fiz
1. Criei mocks extras para
aggregates
,themed_excerpts
ecities
.Criei esses mocks porque
configure_api_app
requeria três argumentos que estavam faltando.2. Criei o método
create_mock_city_interface
.Criei esse método para separar os métodos
get_cities
eget_city
, permitindo que fossem usados noMockCityAccessInterface
.3. Criei o método
get_test_client(self, **kwargs)
que retorna uma instância deTestClient
.Este método cria e retorna uma instância de
TestClient
configurada com mocks personalizados para testar a aplicação.O método aceita argumentos extras (
kwargs
), onde cada chave corresponde ao nome de um componente (comogazettes
) e o valor é o mock personalizado para substituir o padrão. Isso permite passar mocks personalizados sem a necessidade de reescrever oconfigure_api_app
.Exemplo:
4. criei alguns testes para
scraped_since
escraped_until