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
We want the factories for the opportunity attachment tables to be pre-populated with files stored in the columns when we generate them from our factories
An example program that does a bit of this manually with actual files (not a requirement):
deftest_thing(db_session, enable_factory_create):
# Reading a file and writing to the database# We should be able to do something like this in our factories# Potentially with raw text / byte streams insteadwithopen("my_file", "rb") asoutfile:
opp=OpportunityFactory.create(my_attachment=outfile.read())
opp_id=opp.opportunity_id# Force the next query to be from the DB for testing purposesdb_session.commit()
db_session.expire_all()
db_opp=db_session.query(Opportunity).filter(Opportunity.opportunity_id==opp_id).one_or_none()
# Attaching opportunitywithopen("out_file.txt", "wb") asoutfile:
outfile.write(db_opp.my_attachment)
Acceptance criteria
Factories work to create dummy "files" in the staging and foreign DB tables
The contents of the files don't really matter, feel free to generate the bytes on the fly. It's fine to turn a text string into bytes, so long as it can later be made into a file.
The text was updated successfully, but these errors were encountered:
Summary
We want the factories for the opportunity attachment tables to be pre-populated with files stored in the columns when we generate them from our factories
An example program that does a bit of this manually with actual files (not a requirement):
Acceptance criteria
The text was updated successfully, but these errors were encountered: