1- package httpapi_test
1+ package codersdk_test
22
33import (
44 "strings"
77 "github.com/stretchr/testify/assert"
88 "github.com/stretchr/testify/require"
99
10- "github.com/coder/coder/v2/coderd/httpapi "
10+ "github.com/coder/coder/v2/codersdk "
1111 "github.com/coder/coder/v2/testutil"
1212)
1313
@@ -62,7 +62,7 @@ func TestUsernameValid(t *testing.T) {
6262 testCase := testCase
6363 t .Run (testCase .Username , func (t * testing.T ) {
6464 t .Parallel ()
65- valid := httpapi .NameValid (testCase .Username )
65+ valid := codersdk .NameValid (testCase .Username )
6666 require .Equal (t , testCase .Valid , valid == nil )
6767 })
6868 }
@@ -117,7 +117,7 @@ func TestTemplateDisplayNameValid(t *testing.T) {
117117 testCase := testCase
118118 t .Run (testCase .Name , func (t * testing.T ) {
119119 t .Parallel ()
120- valid := httpapi .DisplayNameValid (testCase .Name )
120+ valid := codersdk .DisplayNameValid (testCase .Name )
121121 require .Equal (t , testCase .Valid , valid == nil )
122122 })
123123 }
@@ -158,7 +158,7 @@ func TestTemplateVersionNameValid(t *testing.T) {
158158 testCase := testCase
159159 t .Run (testCase .Name , func (t * testing.T ) {
160160 t .Parallel ()
161- valid := httpapi .TemplateVersionNameValid (testCase .Name )
161+ valid := codersdk .TemplateVersionNameValid (testCase .Name )
162162 require .Equal (t , testCase .Valid , valid == nil )
163163 })
164164 }
@@ -169,7 +169,7 @@ func TestGeneratedTemplateVersionNameValid(t *testing.T) {
169169
170170 for i := 0 ; i < 1000 ; i ++ {
171171 name := testutil .GetRandomName (t )
172- err := httpapi .TemplateVersionNameValid (name )
172+ err := codersdk .TemplateVersionNameValid (name )
173173 require .NoError (t , err , "invalid template version name: %s" , name )
174174 }
175175}
@@ -199,9 +199,9 @@ func TestFrom(t *testing.T) {
199199 testCase := testCase
200200 t .Run (testCase .From , func (t * testing.T ) {
201201 t .Parallel ()
202- converted := httpapi .UsernameFrom (testCase .From )
202+ converted := codersdk .UsernameFrom (testCase .From )
203203 t .Log (converted )
204- valid := httpapi .NameValid (converted )
204+ valid := codersdk .NameValid (converted )
205205 require .True (t , valid == nil )
206206 if testCase .Match == "" {
207207 require .NotEqual (t , testCase .From , converted )
@@ -245,9 +245,9 @@ func TestUserRealNameValid(t *testing.T) {
245245 testCase := testCase
246246 t .Run (testCase .Name , func (t * testing.T ) {
247247 t .Parallel ()
248- err := httpapi .UserRealNameValid (testCase .Name )
249- norm := httpapi .NormalizeRealUsername (testCase .Name )
250- normErr := httpapi .UserRealNameValid (norm )
248+ err := codersdk .UserRealNameValid (testCase .Name )
249+ norm := codersdk .NormalizeRealUsername (testCase .Name )
250+ normErr := codersdk .UserRealNameValid (norm )
251251 assert .NoError (t , normErr )
252252 assert .Equal (t , testCase .Valid , err == nil )
253253 assert .Equal (t , testCase .Valid , norm == testCase .Name , "invalid name should be different after normalization" )
0 commit comments