{"guid":"48b9a297-3d62-5764-96bb-f4bb7704d1a5","title":"How to fake properly","subtitle":null,"slug":"glt19-78-how-to-fake-properly","link":"https://pretalx.linuxtage.at/glt19/talk/EJ8DEV","description":"Aiming at complete code coverage by unit tests tends to be cumbersome, especially for cases where external API calls a part of the code base. Python attempts to address this issue with its unittest.mock library, appearing to be a powerful companion in replacing parts of the system under test.\n\nFirst and foremost, there will be a thorough discussion of the relevant use cases implemented in Python’s unittest.mock library. To move on, I will outline how this mocking functionality can be embedded in a pytest based test suite, amongst discussing the feasibility of replacing parts of the system under test. Eventually, I will discuss examples of production code unit tests that make use of the mock object library, thereby contributing to a solid understanding of the matter.","original_language":"eng","persons":["Rainer Schuettengruber"],"tags":["glt19","78","Entwickler","Graz","linuxtage"],"view_count":90,"promoted":false,"date":"2019-04-27T00:00:00.000+02:00","release_date":"2019-04-27T02:00:00.000+02:00","updated_at":"2025-06-16T16:45:03.796+02:00","length":2537,"duration":2537,"thumb_url":"https://static.media.ccc.de/media/events/glt/2019/78-hd.jpg","poster_url":"https://static.media.ccc.de/media/events/glt/2019/78-hd_preview.jpg","timeline_url":"https://static.media.ccc.de/media/events/glt/2019/78-hd.timeline.jpg","thumbnails_url":"https://static.media.ccc.de/media/events/glt/2019/78-hd.thumbnails.vtt","frontend_link":"https://media.ccc.de/v/glt19-78-how-to-fake-properly","url":"https://api.media.ccc.de/public/events/48b9a297-3d62-5764-96bb-f4bb7704d1a5","conference_title":"Grazer Linuxtage 2019","conference_url":"https://api.media.ccc.de/public/conferences/glt19","related":[{"event_id":6972,"event_guid":"c9e1f2a1-4e12-5b01-b3f6-c3d6ff75f6e8","weight":5},{"event_id":6979,"event_guid":"759452a6-1104-5f96-95bd-424273c5df7a","weight":6},{"event_id":6981,"event_guid":"c1399e8e-cdb7-53f2-9454-907bcf78d0e8","weight":10},{"event_id":6985,"event_guid":"814a06d5-678e-5402-9aee-f89bc58654e9","weight":5},{"event_id":6986,"event_guid":"741d3a54-150b-5d97-81ae-b5ad18351c33","weight":5},{"event_id":6989,"event_guid":"f852b8bf-5c19-572f-90b6-f0149a68ce93","weight":6},{"event_id":6990,"event_guid":"f6cd723d-64bc-5ab1-b0ad-d33cdacf3c18","weight":8},{"event_id":6994,"event_guid":"8e9740a2-56f3-581c-b17d-fe1e63e84976","weight":5},{"event_id":7008,"event_guid":"4b09935b-d2b9-5609-8ac9-46f255c40fcb","weight":3},{"event_id":7016,"event_guid":"1ef521cc-4b8f-590c-8738-15bea2657941","weight":5},{"event_id":7017,"event_guid":"6d1f2cf8-fc88-5d9a-adc6-54e3e4804bc0","weight":5}],"recordings":[{"size":145,"length":2537,"mime_type":"video/mp4","language":"eng","filename":"glt19-78-eng-How_to_fake_properly_hd.mp4","state":"new","folder":"h264-hd","high_quality":true,"width":1920,"height":1080,"updated_at":"2019-04-27T15:50:25.331+02:00","recording_url":"https://cdn.media.ccc.de/events/glt19/h264-hd/glt19-78-eng-How_to_fake_properly_hd.mp4","url":"https://api.media.ccc.de/public/recordings/34910","event_url":"https://api.media.ccc.de/public/events/48b9a297-3d62-5764-96bb-f4bb7704d1a5","conference_url":"https://api.media.ccc.de/public/conferences/glt19"},{"size":65,"length":2537,"mime_type":"video/mp4","language":"eng","filename":"glt19-78-eng-How_to_fake_properly_sd.mp4","state":"new","folder":"h264-sd","high_quality":false,"width":720,"height":576,"updated_at":"2019-04-27T16:36:36.135+02:00","recording_url":"https://cdn.media.ccc.de/events/glt19/h264-sd/glt19-78-eng-How_to_fake_properly_sd.mp4","url":"https://api.media.ccc.de/public/recordings/34930","event_url":"https://api.media.ccc.de/public/events/48b9a297-3d62-5764-96bb-f4bb7704d1a5","conference_url":"https://api.media.ccc.de/public/conferences/glt19"},{"size":38,"length":2537,"mime_type":"audio/mpeg","language":"eng","filename":"glt19-78-eng-How_to_fake_properly_mp3.mp3","state":"new","folder":"mp3","high_quality":false,"width":0,"height":0,"updated_at":"2019-04-27T16:38:35.079+02:00","recording_url":"https://cdn.media.ccc.de/events/glt19/mp3/glt19-78-eng-How_to_fake_properly_mp3.mp3","url":"https://api.media.ccc.de/public/recordings/34934","event_url":"https://api.media.ccc.de/public/events/48b9a297-3d62-5764-96bb-f4bb7704d1a5","conference_url":"https://api.media.ccc.de/public/conferences/glt19"},{"size":101,"length":2537,"mime_type":"video/webm","language":"eng","filename":"glt19-78-eng-How_to_fake_properly_webm-sd.webm","state":"new","folder":"webm-sd","high_quality":false,"width":720,"height":576,"updated_at":"2019-04-27T16:39:06.164+02:00","recording_url":"https://cdn.media.ccc.de/events/glt19/webm-sd/glt19-78-eng-How_to_fake_properly_webm-sd.webm","url":"https://api.media.ccc.de/public/recordings/34935","event_url":"https://api.media.ccc.de/public/events/48b9a297-3d62-5764-96bb-f4bb7704d1a5","conference_url":"https://api.media.ccc.de/public/conferences/glt19"},{"size":26,"length":2537,"mime_type":"audio/opus","language":"eng","filename":"glt19-78-eng-How_to_fake_properly_opus.opus","state":"new","folder":"opus","high_quality":false,"width":0,"height":0,"updated_at":"2019-04-27T16:39:34.291+02:00","recording_url":"https://cdn.media.ccc.de/events/glt19/opus/glt19-78-eng-How_to_fake_properly_opus.opus","url":"https://api.media.ccc.de/public/recordings/34936","event_url":"https://api.media.ccc.de/public/events/48b9a297-3d62-5764-96bb-f4bb7704d1a5","conference_url":"https://api.media.ccc.de/public/conferences/glt19"},{"size":224,"length":2537,"mime_type":"video/webm","language":"eng","filename":"glt19-78-eng-How_to_fake_properly_webm-hd.webm","state":"new","folder":"webm-hd","high_quality":true,"width":1920,"height":1080,"updated_at":"2019-04-27T16:53:56.605+02:00","recording_url":"https://cdn.media.ccc.de/events/glt19/webm-hd/glt19-78-eng-How_to_fake_properly_webm-hd.webm","url":"https://api.media.ccc.de/public/recordings/34955","event_url":"https://api.media.ccc.de/public/events/48b9a297-3d62-5764-96bb-f4bb7704d1a5","conference_url":"https://api.media.ccc.de/public/conferences/glt19"}]}