You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to mock out and test a m2m field get set in my test.
I'm also using model_bakery for fixtures
The code I want to test is: provider_currency.supported_countries.set(supported_countries)
And my test code:
provider_currency = baker.prepare(ProviderCurrency, provider=provider)
countries = baker.prepare(Country)
mock_countries = MockSet(countries, model=Country)
with mocked_relations(ProviderCurrency):
provider_currency.supported_countries = mock_countries
my_method()
It tells me AttributeError: Mock object has no attribute 'set' so it tells me my ProviderCurrency isn't getting returned properly I guess. I tried mocking out ProviderCurrency.objects.get_or_create(), but then I get AttributeError: Mock object has no attribute 'supported_countries'
The text was updated successfully, but these errors were encountered:
I'm trying to mock out and test a m2m field get set in my test.
I'm also using model_bakery for fixtures
The code I want to test is:
provider_currency.supported_countries.set(supported_countries)
And my test code:
It tells me
AttributeError: Mock object has no attribute 'set'
so it tells me my ProviderCurrency isn't getting returned properly I guess. I tried mocking out ProviderCurrency.objects.get_or_create(), but then I getAttributeError: Mock object has no attribute 'supported_countries'
The text was updated successfully, but these errors were encountered: