Closed harrislapiroff closed 6 years ago
Failed build was https://circleci.com/gh/freedomofpress/securedrop.org/1006.
I think the problem is compounded because of this setup:
Language
, Country
, and Topic
(all taxonomy models for DirectoryEntry
s) all inherit from a BaseItem
model. BaseItem
is not an abstract model, meaning that it uses Django's concrete inheritance—i.e., all three models get stored in the same database table. So when generating random data for testing if the same name is generated for both a Language
and Country
, for example, it will violate a uniqueness constraint.
A quick solution here would be to rewrite the test factories to generate names like Language 1
, Language 2
, Country 1
, Country 2
, etc. IMO a better solution would be to forego Django's concrete inheritance, make BaseItem
an abstract model, and put Language
s, Country
s, and Topic
s each in their own database table. Unfortunately, once again, this requires some non-trivial database migration...
I'm working on the latter solution on my scanner-restructure
branch
I'm gonna call this resolved, based on #445, but if it crops up again we can reopen.
As detailed in https://github.com/freedomofpress/securedrop.org/pull/431#issuecomment-382420512