// Copyright 2020 The Gogs Authors. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. package app import ( "testing" "github.com/stretchr/testify/assert" ) func Test_ipynbSanitizer(t *testing.T) { p := ipynbSanitizer() tests := []struct { name string input string want string }{ { name: "allow 'class' and 'data-prompt-number' attributes", input: `
Hello world
`, want: `
Hello world
`, }, { name: "allow base64 encoded images", input: `
`, want: `
`, }, { name: "prevent XSS", input: `
`, want: `
`, }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { assert.Equal(t, test.want, p.Sanitize(test.input)) }) } }