Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Préfixe le titre des contenus des fixtures par leur taille #6648

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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