Questions tagged as 'mock'

0
answers

How to create a Mock in Ruby On Rails (CarrierWave) to simulate sending image to an S3 (Cloudinary)

I've created a project creation system with an image. My images are sent to Cloudinary + CarrierWave. Before the Test did not break because I sent it to the server, however when I joined the Cloudinary the code broke. I think I know what i...
asked by 27.11.2014 / 12:04
1
answer

How to perform tests on private methods using Mockito

This weekend I read about Mockito and trial stunts, and the following idea came to me. Test private methods with this framework. I see that PowerMock performs this procedure, but has anyone tried to do this using Mockito...
asked by 18.08.2014 / 15:31
0
answers

Problem performing a test with POST method

I'm trying to run a unit test of the post method, but the system returns the expected status but was < 404 & gt ;. If I use postaman with Json that I'm creating in Java, it returns the status 200 (OK) Test Class @RunWith(SpringRunner....
asked by 15.05.2018 / 16:27
0
answers

Test API Python

How can I test a url of an api using nosetest For example: I have the following api: /api/user How to ensure that calls in this url are being called? make a GET ... a POST passing the parameters in the body I tri...
asked by 20.03.2017 / 19:35
0
answers

Configuration of fixture mocker in pytest-mock

I'd like to do tests using pytest-mock. I have already run the pip install pytest-mock command and installed it, but when I run the test below, pytest can not find the fixture. What can it be? import pytest def test_unix_fs(mocker): mo...
asked by 23.03.2017 / 03:37
1
answer

unittest.mock: How can I move datetime.datetime.now with different calls in the same method?

How can I proceed with a mock test in datetime.datetime.now with different calls in the same method? In my test, the current date is returned. Following is an example of the code to help you. Thank you in advance. from datetime import da...
asked by 14.12.2018 / 18:11
0
answers

Python: unittest.mock

Hello everyone, good afternoon. Require once again the wisdom and experience of the community! : D I have the following code: def save_html_file(conteudo, filename, encoding='iso8859-1'): assert isinstance(conteudo, str), '"conteudo"...
asked by 25.10.2018 / 21:36
0
answers

How to perform unittest with unittest.mock for reading and writing files?

Good Night !!! This time my doubt is about unit testing. Come on. How can I test the following in the unittest.mock environment? def save_html_file(conteudo, filename, encoding='iso8859-1'): assert isinstance(conteudo, str), '"conteudo"...
asked by 08.10.2018 / 03:45
0
answers

When I'm running JUnit the RestController does not accept JSON

I'm trying to do a test with MockMVC in my application, however, when I run the test it always gives this error: org.springframework.web.HttpMediaTypeNotSupportedException I noticed that when it is in scope of tests, the controller does no...
asked by 17.08.2018 / 15:35
0
answers

How to do Mock IMemoryCache c #

I'm trying to test a class that implements IMemoryCache (IMemoryCache contains static methods which can not be mocados). This is what I tried to do: var teste = new Mock<IMemoryCache>(); mockCache.Setup(m => m.Set(It.IsAny<strin...
asked by 06.05.2018 / 13:23