15,973 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
0
votes
0
answers
22
views
How to mock multipart/form-data with pytest?
I have a POST endpoint with fastapi that goes a little like this. This takes in an excel file and turns it into a pandas dataframe.
@router.post(
"/endpoint/upload_excel",
status_code=status....
0
votes
1
answer
41
views
I can only run my backend tests locally because all the instances of the mocked environment are created and into the actual db because of celery
I want to create tests but every time I run a test it triggers celery and celery creates instances into my local db. that means that if I run those tests in the prod or dev servers, then it will ...
0
votes
0
answers
63
views
Junit test case failing
I have a springboot maven project in which I have a very simple class which has a static method which takes in a http client, some configs and an object mapper
This class is under package com.cs....
0
votes
1
answer
83
views
Mocking nested functions in a Hardware Abstraction Layer
I am using ceedling to unit test a file called adc.c that depends on functions defined in HAL file stm32h7xx_hal_adc_ex.c. The documentation says that I should only include the top level header file ...
-1
votes
1
answer
24
views
Python unittest.mock fails when using pydantic.BaseModel
I have come across this problem when making my unit tests.
from unittest.mock import AsyncMock, patch
import pydantic
# class Parent(): # Using non-pydantic class works
class Parent(pydantic....
1
vote
1
answer
213
views
How to correctly configure the MapperConfiguration?
private readonly IMapper _mapper;
public CreateDepartmentRequestHandlerTests()
{
var config = new MapperConfiguration(cfg => cfg.AddProfile(new CreateDepartmentProfile()));
_mapper = ...
1
vote
1
answer
48
views
Mock patch sys.stdout to StringIO as a decorator
I am trying to mock.patch sys.stdout to StringIO as a decorator to record the output for testing.
As a 'with' statement it works this way:
with mock.patch('sys.stdout', new_callable = StringIO) as ...
1
vote
1
answer
110
views
How to mock SQL DB in Go unit tests?
I have a unit test testing service layer of my REST APIs. What I want to test is RegisterAccount in the service layer, which has dependencies on Repository (Database access layer). How do I mock in ...
2
votes
1
answer
61
views
Stub a method on a Thor CLI
I have a Thor class that has a getter method defined like this:
# Playgrounds CLI skeleton class.
# Commands are added from commands folder
class CLI < Thor
def self.exit_on_failure?
true
...
0
votes
0
answers
22
views
How can I Mock QueryMultipleAsync
How to Unit Test a Method Using QueryMultipleAsync?
I have a method that uses Dapper’s QueryMultipleAsync to retrieve multiple result sets from a database. What is the recommended way to unit test ...
0
votes
0
answers
32
views
Fake TableClient.QueryAsync<TableEntity>()
I'm trying to mock the return set in tableClient.QueryAsycn<TableEntity>(), but it continues to return empty lists. Is there anything glaringly obvious that I'm missing in my unit test.
The ...
0
votes
1
answer
76
views
Test case throwing NPE when calling mocked method
I am trying to write a Mockito test class to cover some db interaction. The test case I am writing is supposed to return a stub response when the database call is invoked, but it's throwing an NPE ...
1
vote
2
answers
51
views
Does GLib's "GTest" testing framework have any filesystem mocking functionality?
I'm writing tests for some code that interacts with the filesystem, and I want to assert that it writes the expected data to disk. My problem is that some of the code I want to test includes hardcoded ...
0
votes
0
answers
29
views
How to mock NgxSummernoteDirective
I am testing an angular component, which uses a summernote-editor from NgxSummernoteModule. The editor form ist set up by NgxSummernoteDirective using the methode createEditor():
createEditor() {
...
0
votes
0
answers
143
views
How to set up client (browser) msw worker in NextJS 15
I've been trying to setup Mock Service Worker in my NextJS 15 app (App Router) and faced problems with my client workers.
Here are my files with setupWorker/setupServer:
@src/shared/api/mocks/server....