Mockear servicios HTTP en Rust con httpmock
robertohuertasm
Aprende como mockear las llamadas http de tu librería a otros servicios en tus tests.
El código del proyecto: https://github.com/robertohuertasm/yt-units-http-mocking
httpmock: https://docs.rs/httpmock/latest/httpmock Artículo: https://alexliesenfeld.com/mocking-http-services-in-rust
00:00 Intro 00:05 Presentación 00:15 Crear nuevo proyecto 01:00 Crear nuestro test 03:15 Añadir dependencias con Cargo Edit 05:00 Struct UserRepo 05:45 Impl Default y JSONPlaceholder 06:50 Implementar new() 09:02 Implementar get_first() y struct User 11:00 Pasar el test y --nocapture 11:32 Problemas de la implementación del test 13:24 Mockear una petición 16:30 Conclusiones 16:58 Despedida
#rust #rustlang #rustenespañol #http #rest #mock #testing #tests ... https://www.youtube.com/watch?v=Tq03a6xMz3I
77639333 Bytes