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 bcf7ef9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 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
11 changes: 2 additions & 9 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 All @@ -157,7 +158,6 @@ class CustomProvider(BaseProvider):
"s3://local-opportunities/test_file_5.pdf",
]

MARKUP_STRING = "<div>{{paragraph}} <a href='{{relevant_url}}'>{{sentence}}</a> {{paragraph}}</div><div>{{paragraph}} <a href='{{relevant_url}}'>{{sentence}}</a> {{paragraph}}</div>"

def agency_code(self) -> str:
return self.random_element(self.AGENCIES)
Expand Down Expand Up @@ -191,6 +191,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 +204,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 +589,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 bcf7ef9

Please sign in to comment.