Skip to content

Commit

Permalink
Préfixe le titre des contenus des fixtures par leur taille
Browse files Browse the repository at this point in the history
  • Loading branch information
philippemilink committed Oct 5, 2024
1 parent 77c115d commit dad18e5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions zds/utils/management/commands/load_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,10 +510,11 @@ def load_contents(cli, size, fake, _type, *_, **__):

current_size = content_sizes[created_content_index]
action_flag = what_to_do[created_content_index]
title = ["Mini", "Medium", "Big"][current_size] + " " + fake.text(max_nb_chars=50)

# creation:
content = PublishableContentFactory(
type=_type, title=fake.text(max_nb_chars=60), description=fake.sentence(nb_words=15, variable_nb_words=True)
type=_type, title=title, description=fake.sentence(nb_words=15, variable_nb_words=True)
)

versioned = content.load_version()
Expand Down Expand Up @@ -564,12 +565,12 @@ def validate_edited_content(content, fake, nb_staffs, staffs, to_do, versioned):


def generate_text_for_content(content_size, fake, nb_avg_containers_in_content, nb_avg_extracts_in_content, versioned):
if content_size == 0:
if content_size == 0: # mini
nb_extracts = random.randint(1, nb_avg_extracts_in_content * 2)
for _ in range(nb_extracts):
extract_title = fake.text(max_nb_chars=60)
ExtractFactory(container=versioned, title=extract_title, light=False)
else:
else: # medium or big
nb_containers = random.randint(1, nb_avg_containers_in_content * 2)
for _ in range(nb_containers):
container_title = fake.text(max_nb_chars=60)
Expand Down

0 comments on commit dad18e5

Please sign in to comment.