❮ TOC
❯
Fixtures and Mocking in Python
- How do you test Moon-landing?
- How do you test a system ...
- Plan
- About me
- Goal
- Fixtures
- Fixtuers in Pytest
- Traditional xUnit fixtures
- Dependency Injection
- Temporary directory - tmpdir
- Capture STDOUT and STDERR - capsys
- Home-made fixture
- Home-made fixture - conftest
- Home-made fixture with tempdir
- Home-made fixture with yield
- Fixture Autouse
- Fixture Autouse with yield
- Fixture for MongoDB
- Test Doubles
- Test Doubles explained
- Verify behavior or state?
- What is Mocking and Monkey Patching?
- Situations
- Unit testing vs. Integration testing
- Experiment with mocking in various situations
- Examples are simple
- Hard coded path
- Manually Patching attribute
- Monkey Patching attribute
- Monkey Patching functions
- Monkey Patching dictionary items
- Mocking a whole class
- Mocking input/output
- Mocking input/output
- Mocking random numbers
- Exercises
- Work in pairs
- Exercise: test login expiration
- Solution: test login expiration
- Exercise: Record e-mail sending
- Solution: Record e-mail sending
- Exercise: Fixture database
- Exercise: One Dimentsional space-fight
- Exercise: web client
- Exercise: Open WeatherMap client
- Exercise: Mocking A Bank
- Testing the whole application
- Resources
- Retrospective
- Job searching help
- Solutions - game
- Solutions - Mocking the database access