Skip to content

Commit

Permalink
rethink seeding strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
doug-s-nava committed Nov 22, 2024
1 parent b1b9b91 commit 630e230
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
4 changes: 0 additions & 4 deletions api/tests/lib/seed_local_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,6 @@ def _build_opportunities(db_session: db.Session, iterations: int, include_histor
size=2, is_posted_summary=True, has_long_descriptions=True
)

factories.OpportunityFactory.create_batch(
size=3, is_posted_summary=True, has_markup_descriptions=True
)

if include_history:
_add_history(forecasted_opps, add_forecast_hist=True)
_add_history(
Expand Down
10 changes: 2 additions & 8 deletions api/tests/src/db/models/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ class CustomProvider(BaseProvider):
"{{agency_code}} is looking to further investigate this topic. {{paragraph}}",
"<p>{{paragraph}}</p><p><br></p><p>{{paragraph}}</p>",
"The purpose of this Notice of Funding Opportunity (NOFO) is to support research into {{job}} and how we might {{catch_phrase}}.",
"<div>{{paragraph:long}} <a href='{{relevant_url}}'>{{sentence}}</a> {{paragraph:long}}</div> <div>{{paragraph:long}} <a href='{{relevant_url}}'>{{sentence}}</a> {{paragraph:long}}</div>"
]

# In the formatting, ? becomes a random letter, # becomes a random digit
Expand Down Expand Up @@ -191,6 +192,7 @@ def opportunity_title(self) -> str:
return self.generator.parse(pattern)

def summary_description(self) -> str:
self.generator.set_arguments("long", { "nb_sentences": 25 })
pattern = self.random_element(self.SUMMARY_DESCRIPTION_FORMATS)
return self.generator.parse(pattern)

Expand All @@ -203,9 +205,6 @@ def yn_yesno_boolean(self) -> str:
def s3_file_location(self) -> str:
return self.random_element(self.OPPORTUNITY_ATTACHMENT_S3_PATHS)

def complex_markup_string(self) -> str:
return self.generator.parse(self.MARKUP_STRING)


fake = faker.Faker()
fake.add_provider(CustomProvider)
Expand Down Expand Up @@ -591,11 +590,6 @@ class Params:
close_date_description=factory.Faker("paragraph", nb_sentences=30),
)

has_markup_descriptions = factory.Trait(
summary_description=factory.Faker("complex_markup_string"),
)


class CurrentOpportunitySummaryFactory(BaseFactory):
class Meta:
model = opportunity_models.CurrentOpportunitySummary
Expand Down

0 comments on commit 630e230

Please sign in to comment.