I'm not sure if my design is simply stupid, or there's a good way to make it work. Consider the following classes: public abstract class CheckBase { protect
I have the following classes class FileDownloader { public static void downloadFile(String repoUrl, String filename) throws IOException { // Downloa
How to mock a specific instance of a class using patch? In my test file I have: @classmethod def setUpClass(cls): cls.instance_of_my_class = myClass() one
Have this abstract class to get data from remote data source abstract class NumberTriviaRemoteDataSource { /// Calls the http://numberapi.com/{number} endpoin
Input: We have API-A and API-B. API-A sends some requests to API-B and do some work with received data. We have unit tests that verify work of methods that doin
I'm unittesting a function that transforms an element from an S3 object into a pandas DataFrame and need to mock the returned StreamingBody object from boto3 f
I have to test the routes of a controller which uses Guzzle Wrapper as a client to get data from an API. The app uses Laravel as a framework. This is the part o
My class, Foo, has a calculate method that takes no parameters, makes a call to a database and does some calculations using class attributes, and sets another c
I would like to verify there were exactly x interactions with might db mock object. Is there something similar to the 'verifyZeroInteractions()' method for doin
I have a method that among others generates an identifier, sends it to some external dependency and returns it. I want to have a unit test that tests if the sam
Normally, a MagicMock returns new MagicMocks for any attribute or method called on it: >>> mm = MagicMock() >>> mm <MagicMock id='14009455
Normally, a MagicMock returns new MagicMocks for any attribute or method called on it: >>> mm = MagicMock() >>> mm <MagicMock id='14009455
I used Symfony 5.2 and I need to mock service method which execute send request to stripe payment system, obviously don't need to execute it when tests executin
I used Symfony 5.2 and I need to mock service method which execute send request to stripe payment system, obviously don't need to execute it when tests executin
I'm trying to get a unit test working that validates a function that reads credentials from a JSON-encoded file. Since the credentials themselves aren't fixed,
I combine mocking and caching in my code. The mocking is (kind of) random for each pytest as I do not know exactly, what will be returned in the real case. Henc
I have classes like this: /* "Things" can be "zarked", but only when opened, and they must be closed afterwards */ class ThingInterface { public: // Open the
I am trying to create tests for my Flutter application. Simple example: class MyWidget extends StatelessWidget { @override build(BuildContext context) {
I want to set a fixed time using python different than that seen locally on my system , so that when I used datetime.date.today() I get to see the desired date
We wrote a small Spring Boot REST application, which performs a REST request on another REST endpoint. @RequestMapping("/api/v1") @SpringBootApplication @RestC