def test_validate_domain_format_with_invalid_domain(domain, dummy_request): dummy_request.params = dummy_request.POST = MultiDict({ 'csrf_token': dummy_request.session.get_csrf_token(), 'domain': domain, 'application-name': 'Test Site', }) form = build_new_application_site_form(dummy_request) assert not form.validate() assert form.domain.errors
def test_validate_slug_format_with_invalid_slug(slug, dummy_request): dummy_request.params = dummy_request.POST = MultiDict({ 'csrf_token': dummy_request.session.get_csrf_token(), 'slug': slug, 'domain': 'example.org', 'application-name': 'New site', }) form = build_new_application_site_form(dummy_request) assert not form.validate() assert form.slug.errors
def test_username_validations_with_valid_inputs(username, dummy_request): dummy_request.params = dummy_request.POST = MultiDict({ 'csrf_token': dummy_request.session.get_csrf_token(), 'username': username, 'email': '*****@*****.**', 'password': '******', }) form = build_signup_form(dummy_request) assert form.validate() assert not form.errors
def test_namespace_validations_with_invalid_inputs(namespace, dummy_request): project = Project(namespace=namespace) dummy_request.params = dummy_request.POST = MultiDict({ 'csrf_token': dummy_request.session.get_csrf_token(), 'name': 'project-name', 'namespace': namespace, }) form = build_project_form(dummy_request, project) assert not form.validate()
def test_path_validations_with_invalid_path_inputs(path, scope, progress_state, dummy_request): article = Article(path=path) dummy_request.params = dummy_request.POST = MultiDict({ 'csrf_token': dummy_request.session.get_csrf_token(), 'title': 'Title', 'path': path, 'scope': scope, 'progress_state': progress_state['value'], }) form = build_article_settings_form(dummy_request, article) assert not form.validate() assert form.path.errors
def test_validate_slug_format_with_valid_slug(slug, dummy_request): dummy_request.params = dummy_request.POST = MultiDict({ 'csrf_token': dummy_request.session.get_csrf_token(), 'slug': slug, 'domain': None, 'publication-name': 'New site', 'publication-copyright': 'copyright', 'publication-classification': list(Classification.roots)[0].notation, 'publication-license': next(License.as_choices)[0], }) form = build_new_publication_site_form(dummy_request) assert form.validate() assert not form.slug.errors