<commit_before>@user
Feature: Ernest user list

  Background:
    Given I setup ernest with target "https://ernest.local"

  Scenario: Non logged user creation
    Given I logout
    When I run ernest with "user create"
    Then The output should contain "You should specify an user username and a password"
    When I run ernest with "user create user"
    Then The output should contain "You should specify the user password"
    When I run ernest with "user create test_creation secret123"
    Then The output should contain "You're not allowed to perform this action, please log in"

  Scenario: Plain user creation
    When I'm logged in as "usr" / "secret123"
    And I run ernest with "user create test_creation secret123"
    Then The output should contain "You're not allowed to perform this action, please contact your admin"

  Scenario: Admin user creation
    Given the user "test_creation" does not exist
    And I'm logged in as "ci_admin" / "secret123"
    When I run ernest with "user create test_creation secret123"
    Then The output should contain "User test_creation successfully created"

  Scenario: Admin user creation with no username
    Given the user "test_creation" does not exist
    And I'm logged in as "ci_admin" / "secret123"
    When I run ernest with "user create"
    Then The output should contain "You should specify an user username and a password"

  Scenario: Admin user creation with no password
    Given the user "test_creation" does not exist
    And I'm logged in as "ci_admin" / "<PASSWORD>"
    When I run ernest with "user create test_creation"
    Then The output should contain "You should specify the user password"

  Scenario: Admin user creation with a username containing invalid characters
    Given the user "test^creation" does not exist
    And I'm logged in as "ci_admin" / "secret123"
    When I run ernest with "user create test^creation secret123"
    Then The output should contain "Username can only contain the following characters: a-z 0-9 @._-"

  Scenario: Admin user creation with a password less than the minimum length
    Given the user "test_creation" does not exist
    And I'm logged in as "ci_admin" / "secret123"
    When I run ernest with "user create test_creation secret"
    Then The output should contain "Minimum password length is 8 characters"

  Scenario: Admin user creation with a password containing invalid characters
    Given the user "test_creation" does not exist
    And I'm logged in as "ci_admin" / "secret123"
    When I run ernest with "user create test_creation secret^123"
    Then The output should contain "Password can only contain the following characters: a-z 0-9 @._-"

  Scenario: Admin user creation with no username
    Given the user "test_creation" does not exist
    And I'm logged in as "ci_admin" / "secret123"
    When I run ernest with "user create"
    Then The output should contain "You should specify an user username and a password"

  Scenario: Admin user creation with no password
    Given the user "test_creation" does not exist
    And I'm logged in as "ci_admin" / "secret123"
    When I run ernest with "user create test_creation"
    Then The output should contain "You should specify the user password"

  Scenario: Admin user creation with a username containing invalid characters
    Given the user "test^creation" does not exist
    And I'm logged in as "ci_admin" / "secret123"
    When I run ernest with "user create test^creation secret123"
    Then The output should contain "Username can only contain the following characters: a-z 0-9 @._-"

  Scenario: Admin user creation with a password less than the minimum length
    Given the user "test_creation" does not exist
    And I'm logged in as "ci_admin" / "secret123"
    When I run ernest with "user create test_creation secret"
    Then The output should contain "Minimum password length is 8 characters"

  Scenario: Admin user creation with a password containing invalid characters
    Given the user "test_creation" does not exist
    And I'm logged in as "ci_admin" / "secret123"
    When I run ernest with "user create test_creation secret^123"
    Then The output should contain "Password can only contain the following characters: a-z 0-9 @._-"

  Scenario: Duplicated user creation
    When I'm logged in as "ci_admin" / "secret123"
    And I run ernest with "user create duplicated secret123"
    And I run ernest with "user create duplicated secret123"
    Then The output should contain "Specified user already exists"<commit_msg>Removed duplicate tests<commit_after>@user
Feature: Ernest user list

  Background:
    Given I setup ernest with target "https://ernest.local"

  Scenario: Non logged user creation
    Given I logout
    When I run ernest with "user create"
    Then The output should contain "You should specify an user username and a password"
    When I run ernest with "user create user"
    Then The output should contain "You should specify the user password"
    When I run ernest with "user create test_creation secret123"
    Then The output should contain "You're not allowed to perform this action, please log in"

  Scenario: Plain user creation
    When I'm logged in as "usr" / "secret123"
    And I run ernest with "user create test_creation secret123"
    Then The output should contain "You're not allowed to perform this action, please contact your admin"

  Scenario: Admin user creation
    Given the user "test_creation" does not exist
    And I'm logged in as "ci_admin" / "secret123"
    When I run ernest with "user create test_creation secret123"
    Then The output should contain "User test_creation successfully created"

  Scenario: Admin user creation with no username
    Given the user "test_creation" does not exist
    And I'm logged in as "ci_admin" / "secret123"
    When I run ernest with "user create"
    Then The output should contain "You should specify an user username and a password"

  Scenario: Admin user creation with no password
    Given the user "test_creation" does not exist
    And I'm logged in as "ci_admin" / "secret123"
    When I run ernest with "user create test_creation"
    Then The output should contain "You should specify the user password"

  Scenario: Admin user creation with a username containing invalid characters
    Given the user "test^creation" does not exist
    And I'm logged in as "ci_admin" / "secret123"
    When I run ernest with "user create test^creation secret123"
    Then The output should contain "Username can only contain the following characters: a-z 0-9 @._-"

  Scenario: Admin user creation with a password less than the minimum length
    Given the user "test_creation" does not exist
    And I'm logged in as "ci_admin" / "secret123"
    When I run ernest with "user create test_creation secret"
    Then The output should contain "Minimum password length is 8 characters"

  Scenario: Admin user creation with a password containing invalid characters
    Given the user "test_creation" does not exist
    And I'm logged in as "ci_admin" / "secret<PASSWORD>"
    When I run ernest with "user create test_creation secret^123"
    Then The output should contain "Password can only contain the following characters: a-z 0-9 @._-"

  Scenario: Duplicated user creation
    When I'm logged in as "ci_admin" / "secret123"
    And I run ernest with "user create duplicated secret123"
    And I run ernest with "user create duplicated secret123"
    Then The output should contain "Specified user already exists"
{'fraction_non_alphanumeric': 0.0499867056633874, 'fraction_numerical': 0.015953203935123637, 'mean_word_length': 3.6960049937578026, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4614224', 'n_tokens_mistral': 2113, 'n_tokens_neox': 1933, 'n_words': 1057}