Skip to content

add regex validator for project test name#589

Open
Syuparn wants to merge 1 commit intoLexpedite:mainfrom
Syuparn:add-testname-validation
Open

add regex validator for project test name#589
Syuparn wants to merge 1 commit intoLexpedite:mainfrom
Syuparn:add-testname-validation

Conversation

@Syuparn
Copy link

@Syuparn Syuparn commented Mar 30, 2025

This PR adds a test name validator to prevent project crashes.

Since test names cannot have special characters, creating a new test with a special character name causes an error.
Furthermore, once a test with an invalid name has been created in a project, every page in the project throws the same error and the project cannot be used anymore.

(before: creating a new test with a special character name)
blawx_test1

(before: top page in the project throws an error)
blawx_test2

NoReverseMatch at /user1/foobar/
Reverse for 'test' with arguments '(<User: user1>, 'foobar', 'test!')' not found. 1 pattern(s) tried: ['(?P<user>[^/]+)/(?P<rule>[-a-zA-Z0-9_]+)/test/(?P<test_name>[-a-zA-Z0-9_]+)/\\Z']

This PR adds a validator to the BlawxTest model to validate its name before saving it so that any other pages in the project can be accessed afterwards.

(after: a new test with a special character name is validated before saved)
blawx_fixed

(after: top page in the project can be accessed)
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant