-
Notifications
You must be signed in to change notification settings - Fork 54
Open
Description
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'
Metadata
Metadata
Assignees
Labels
No labels