100+ results for '*testing.T randomstring'
Not the results you expected?
DDMFormTestUtil.java (https://github.com/danielreuther/liferay-portal.git) Java · 320 lines
helpers_linux_test.go (https://gitlab.com/Lin0x/oz) Go · 264 lines
27 func Test_NetInterfaceNameValid(t *testing.T) {
28 for _, tt := range ifcNameTests {
52 {testLink{name: "ifc03", linkType: "dummy"},
53 LinkOptions{MacAddr: "fa:de:b0:99:52:1c"}, "randomstring",
54 nil},
57 func Test_FindInterfaceByMacAddress(t *testing.T) {
58 for _, tt := range ifcMacTests {
126 func Test_DockerPidByName(t *testing.T) {
127 for _, tt := range dockerPidTests {
205 func Test_NetNsHandle(t *testing.T) {
206 for _, tt := range netNsTests {
bulk_processor_test.go (https://gitlab.com/vantruong/GolangRestAPI) Go · 421 lines
15 func TestBulkProcessorDefaults(t *testing.T) {
16 client := setupTestClientAndCreateIndex(t)
42 func TestBulkProcessorCommitOnBulkActions(t *testing.T) {
43 //client := setupTestClientAndCreateIndexAndLog(t, SetTraceLog(log.New(os.Stdout, "", 0)))
65 func TestBulkProcessorCommitOnBulkSize(t *testing.T) {
66 //client := setupTestClientAndCreateIndexAndLog(t, SetTraceLog(log.New(os.Stdout, "", 0)))
88 func TestBulkProcessorBasedOnFlushInterval(t *testing.T) {
89 //client := setupTestClientAndCreateIndexAndLog(t, SetTraceLog(log.New(os.Stdout, "", 0)))
126 for i := 1; i <= numDocs; i++ {
127 tweet := tweet{User: "olivere", Message: fmt.Sprintf("%d. %s", i, randomString(rand.Intn(64)))}
128 request := NewBulkIndexRequest().Index(testIndexName).Type("tweet").Id(fmt.Sprintf("%d", i)).Doc(tweet)
session_test.go (https://gitlab.com/tamasd/ab) Go · 130 lines
40 func randomString(length int) string {
41 buf := make([]byte, length)
54 func TestEncDec(t *testing.T) {
55 Convey("Tests encoding and decoding the cookie data", t, func() {
71 func TestHTTPScenario(t *testing.T) {
72 Convey("Given a simple HTTP scenario", t, func() {
104 data := randomString(128)
lbaas_v2.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 282 lines
21 // be created.
22 func CreateListener(t *testing.T, client *gophercloud.ServiceClient, lb *loadbalancers.LoadBalancer) (*listeners.Listener, error) {
23 listenerName := tools.RandomString("TESTACCT-", 8)
50 // subnet. An error will be returned if the loadbalancer could not be created.
51 func CreateLoadBalancer(t *testing.T, client *gophercloud.ServiceClient, subnetID string) (*loadbalancers.LoadBalancer, error) {
52 lbName := tools.RandomString("TESTACCT-", 8)
80 // weight. An error will be returned if the member could not be created.
81 func CreateMember(t *testing.T, client *gophercloud.ServiceClient, lb *loadbalancers.LoadBalancer, pool *pools.Pool, subnetID, subnetCIDR string) (*pools.Member, error) {
82 memberName := tools.RandomString("TESTACCT-", 8)
117 // An error will be returned if the monitor could not be created.
118 func CreateMonitor(t *testing.T, client *gophercloud.ServiceClient, lb *loadbalancers.LoadBalancer, pool *pools.Pool) (*monitors.Monitor, error) {
119 monitorName := tools.RandomString("TESTACCT-", 8)
148 // created.
149 func CreatePool(t *testing.T, client *gophercloud.ServiceClient, lb *loadbalancers.LoadBalancer) (*pools.Pool, error) {
150 poolName := tools.RandomString("TESTACCT-", 8)
random_data_test.go (https://gitlab.com/ezeql/go-randomdata) Go · 257 lines
9 func TestRandomStringDigits(t *testing.T) {
10 t.Log("TestRandomStringDigits")
29 func TestFirstName(t *testing.T) {
30 t.Log("TestFirstName")
49 func TestLastName(t *testing.T) {
50 t.Log("TestLastName")
58 func TestFullName(t *testing.T) {
59 t.Log("TestFullName")
103 func TestEmail(t *testing.T) {
104 t.Log("TestEmail")
extensions.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 173 lines
18 // returned
19 func CreateUploadImage(t *testing.T, client *gophercloud.ServiceClient, volume *volumes.Volume) (volumeactions.VolumeImage, error) {
20 if testing.Short() {
24 imageName := tools.RandomString("ACPTTEST", 16)
25 uploadImageOpts := volumeactions.UploadImageOpts{
48 // if the deletion request failed.
49 func DeleteUploadedImage(t *testing.T, client *gophercloud.ServiceClient, imageName string) error {
50 if testing.Short() {
72 // returned if the attachment failed.
73 func CreateVolumeAttach(t *testing.T, client *gophercloud.ServiceClient, volume *volumes.Volume, server *servers.Server) error {
74 if testing.Short() {
100 // if the reservation failed.
101 func CreateVolumeReserve(t *testing.T, client *gophercloud.ServiceClient, volume *volumes.Volume) error {
102 if testing.Short() {
handshake_messages_test.go (https://gitlab.com/JamesClonk/machine) Go · 246 lines
35 func TestMarshalUnmarshal(t *testing.T) {
36 rand := rand.New(rand.NewSource(0))
83 func TestFuzz(t *testing.T) {
84 rand := rand.New(rand.NewSource(0))
105 func randomString(n int, rand *rand.Rand) string {
106 b := randomBytes(n, rand)
123 if rand.Intn(10) > 5 {
124 m.serverName = randomString(rand.Intn(255), rand)
125 }
158 for i := 0; i < n; i++ {
159 m.nextProtos[i] = randomString(20, rand)
160 }
file_test.go (https://gitlab.com/unofficial-mirrors/mattermost-platform) Go · 163 lines
20 func TestGeneratePublicLinkHash(t *testing.T) {
21 filename1 := model.NewId() + "/" + model.NewRandomString(16) + ".txt"
22 filename2 := model.NewId() + "/" + model.NewRandomString(16) + ".txt"
23 salt1 := model.NewRandomString(32)
24 salt2 := model.NewRandomString(32)
43 func TestDoUploadFile(t *testing.T) {
44 th := Setup()
110 func TestGetInfoForFilename(t *testing.T) {
111 th := Setup().InitBasic()
node_test.go (https://gitlab.com/Red54/machine) Go · 175 lines
19 func TestNodes(t *testing.T) {
20 client := setup(t)
42 func findServer(t *testing.T) string {
43 var serverIP string
74 opts := &servers.CreateOpts{
75 Name: tools.RandomString("lb_test_", 5),
76 ImageRef: imageRef,
94 func addNodes(t *testing.T, client *gophercloud.ServiceClient, lbID int, serverIP string) int {
95 opts := nodes.CreateOpts{
123 func listNodes(t *testing.T, client *gophercloud.ServiceClient, lbID int) {
124 err := nodes.List(client, lbID, nil).EachPage(func(page pagination.Page) (bool, error) {
secgroup_test.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 137 lines
13 func TestSecGroupsList(t *testing.T) {
14 client, err := clients.NewComputeV2Client()
34 func TestSecGroupsCreate(t *testing.T) {
35 client, err := clients.NewComputeV2Client()
47 func TestSecGroupsUpdate(t *testing.T) {
48 client, err := clients.NewComputeV2Client()
59 updateOpts := secgroups.UpdateOpts{
60 Name: tools.RandomString("secgroup_", 4),
61 Description: tools.RandomString("dec_", 10),
71 func TestSecGroupsRuleCreate(t *testing.T) {
72 client, err := clients.NewComputeV2Client()
domains_test.go (https://gitlab.com/github-cloud-corporation/dex) Go · 96 lines
12 func TestGetDomains(t *testing.T) {
13 domain := reqEnv(t, "MG_DOMAIN")
26 func TestGetSingleDomain(t *testing.T) {
27 domain := reqEnv(t, "MG_DOMAIN")
48 func TestGetSingleDomainNotExist(t *testing.T) {
49 domain := reqEnv(t, "MG_DOMAIN")
51 mg := mailgun.NewMailgun(domain, apiKey, "")
52 _, _, _, err := mg.GetSingleDomain(randomString(32, "com.edu.org.")+".com")
53 if err == nil {
65 func TestAddDeleteDomain(t *testing.T) {
66 // First, we need to add the domain.
lb_test.go (https://gitlab.com/Red54/machine) Go · 214 lines
17 func TestLBs(t *testing.T) {
18 client := setup(t)
44 func createLB(t *testing.T, client *gophercloud.ServiceClient, count int) []int {
45 ids := []int{}
48 opts := lbs.CreateOpts{
49 Name: tools.RandomString("test_", 5),
50 Port: 80,
83 func listLBProtocols(t *testing.T, client *gophercloud.ServiceClient) {
84 err := lbs.ListProtocols(client).EachPage(func(page pagination.Page) (bool, error) {
97 func listLBAlgorithms(t *testing.T, client *gophercloud.ServiceClient) {
98 err := lbs.ListAlgorithms(client).EachPage(func(page pagination.Page) (bool, error) {
layer3.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 250 lines
15 // will be returned if the creation failed.
16 func CreateFloatingIP(t *testing.T, client *gophercloud.ServiceClient, networkID, portID string) (*floatingips.FloatingIP, error) {
17 t.Logf("Attempting to create floating IP on port: %s", portID)
36 // creation failed.
37 func CreateExternalRouter(t *testing.T, client *gophercloud.ServiceClient) (*routers.Router, error) {
38 var router *routers.Router
44 routerName := tools.RandomString("TESTACC-", 8)
76 // returned if the creation failed.
77 func CreateRouter(t *testing.T, client *gophercloud.ServiceClient, networkID string) (*routers.Router, error) {
78 routerName := tools.RandomString("TESTACC-", 8)
108 // returned if the operation fails.
109 func CreateRouterInterface(t *testing.T, client *gophercloud.ServiceClient, portID, routerID string) (*routers.InterfaceInfo, error) {
110 t.Logf("Attempting to add port %s to router %s", portID, routerID)
handshake_messages_test.go (git://github.com/axw/llgo.git) Go · 262 lines
35 func TestMarshalUnmarshal(t *testing.T) {
36 rand := rand.New(rand.NewSource(0))
83 func TestFuzz(t *testing.T) {
84 rand := rand.New(rand.NewSource(0))
105 func randomString(n int, rand *rand.Rand) string {
106 b := randomBytes(n, rand)
123 if rand.Intn(10) > 5 {
124 m.serverName = randomString(rand.Intn(255), rand)
125 }
142 for i := range m.alpnProtocols {
143 m.alpnProtocols[i] = randomString(rand.Intn(20)+1, rand)
144 }
jenkins_test.go (https://gitlab.com/Kravcenko/gojenkins) Go · 178 lines
16 func TestInit(t *testing.T) {
17 jenkins = CreateJenkins("http://localhost:8080", "admin", "admin")
22 func TestCreateJobs(t *testing.T) {
23 job1ID := "Job1_test"
39 func TestCreateNodes(t *testing.T) {
58 func TestCreateBuilds(t *testing.T) {
59 jobs, _ := jenkins.GetAllJobs()
74 func TestCreateViews(t *testing.T) {
75 list_view, err := jenkins.CreateView("test_list_view", LIST_VIEW)
secgroup_test.go (https://gitlab.com/JamesClonk/machine) Go · 177 lines
16 func TestSecGroups(t *testing.T) {
17 client, err := newClient()
26 newName := tools.RandomString("secgroup_", 5)
27 updateSecGroup(t, client, groupID, newName)
44 func createSecGroup(t *testing.T, client *gophercloud.ServiceClient) string {
45 opts := secgroups.CreateOpts{
46 Name: tools.RandomString("secgroup_", 5),
47 Description: "something",
58 func listSecGroups(t *testing.T, client *gophercloud.ServiceClient) {
59 err := secgroups.List(client).EachPage(func(page pagination.Page) (bool, error) {
file_test.go (https://gitlab.com/ricardo.hernandez/telegraf) Go · 196 lines
23 func TestFileExistingFile(t *testing.T) {
24 fh := createFile()
43 func TestFileNewFile(t *testing.T) {
44 s, _ := serializers.NewInfluxSerializer()
63 func TestFileExistingFiles(t *testing.T) {
64 fh1 := createFile()
88 func TestFileNewFiles(t *testing.T) {
89 s, _ := serializers.NewInfluxSerializer()
112 func TestFileBoth(t *testing.T) {
113 fh1 := createFile()
identity.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 186 lines
16 // returned if the grant was unsuccessful.
17 func AddUserRole(t *testing.T, client *gophercloud.ServiceClient, tenant *tenants.Tenant, user *users.User, role *roles.Role) error {
18 t.Logf("Attempting to grant user %s role %s in tenant %s", user.ID, role.ID, tenant.ID)
33 // unable to be created.
34 func CreateTenant(t *testing.T, client *gophercloud.ServiceClient, c *tenants.CreateOpts) (*tenants.Tenant, error) {
35 name := tools.RandomString("ACPTTEST", 8)
59 // tenant. An error will be returned if the user was unable to be created.
60 func CreateUser(t *testing.T, client *gophercloud.ServiceClient, tenant *tenants.Tenant) (*users.User, error) {
61 userName := tools.RandomString("user_", 5)
82 // a deferred function.
83 func DeleteTenant(t *testing.T, client *gophercloud.ServiceClient, tenantID string) {
84 err := tenants.Delete(client, tenantID).ExtractErr()
93 // unsuccessful. This works best when used as a deferred function.
94 func DeleteUser(t *testing.T, client *gophercloud.ServiceClient, user *users.User) {
95 t.Logf("Attempting to delete user: %s", user.Name)
helpers_test.go (https://gitlab.com/epicglue/epicglue) Go · 141 lines
32 func TestRandomString(t *testing.T) {
33 r1 := helpers.RandomString(8)
36 r2 := helpers.RandomString(8)
37 assert.Len(t, r2, 8)
39 r3 := helpers.RandomString(1)
40 assert.Len(t, r3, 1)
61 func TestFlattenArrayOfStrings(t *testing.T) {
62 assert.Equal(t, "[]", helpers.FlattenArrayOfStrings([]string{}))
78 func TestStringToFloat64(t *testing.T) {
79 assert.Equal(t, helpers.StringToFloat64("4.11"), float64(4.11))
env_test.go (https://gitlab.com/JamesClonk/machine) Go · 324 lines
27 func TestEnvLenDup(t *testing.T) {
28 env := &Env{
39 func TestEnvGetDup(t *testing.T) {
40 env := &Env{
51 func TestNewJob(t *testing.T) {
52 job := mkJob(t, "dummy", "--level=awesome")
80 func TestSetenvBool(t *testing.T) {
81 job := mkJob(t, "dummy")
165 for i := 0; i < l; i++ {
166 t := [2]string{testutils.RandomString(5), testutils.RandomString(20)}
167 res[i] = t
extensions.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 142 lines
16 // returned if the creation failed.
17 func CreateExternalNetwork(t *testing.T, client *gophercloud.ServiceClient) (*networks.Network, error) {
18 networkName := tools.RandomString("TESTACC-", 8)
46 // attached. An error will be returned if the port could not be created.
47 func CreatePortWithSecurityGroup(t *testing.T, client *gophercloud.ServiceClient, networkID, subnetID, secGroupID string) (*ports.Port, error) {
48 portName := tools.RandomString("TESTACC-", 8)
72 // An error will be returned if one was failed to be created.
73 func CreateSecurityGroup(t *testing.T, client *gophercloud.ServiceClient) (*groups.SecGroup, error) {
74 secGroupName := tools.RandomString("TESTACC-", 8)
94 // An error will be returned if one was failed to be created.
95 func CreateSecurityGroupRule(t *testing.T, client *gophercloud.ServiceClient, secGroupID string) (*rules.SecGroupRule, error) {
96 t.Logf("Attempting to create security group rule in group: %s", secGroupID)
122 // deferred function
123 func DeleteSecurityGroup(t *testing.T, client *gophercloud.ServiceClient, secGroupID string) {
124 t.Logf("Attempting to delete security group: %s", secGroupID)
db.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 145 lines
18 // An error will be returned if the database was unable to be created.
19 func CreateDatabase(t *testing.T, client *gophercloud.ServiceClient, instanceID string) error {
20 name := tools.RandomString("ACPTTEST", 8)
36 // An error will be returned if the instance was unable to be created.
37 func CreateInstance(t *testing.T, client *gophercloud.ServiceClient) (*instances.Instance, error) {
38 if testing.Short() {
47 name := tools.RandomString("ACPTTEST", 8)
48 t.Logf("Attempting to create instance: %s", name)
73 // An error will be returned if the user was unable to be created.
74 func CreateUser(t *testing.T, client *gophercloud.ServiceClient, instanceID string) error {
75 name := tools.RandomString("ACPTTEST", 8)
76 password := tools.RandomString("", 8)
77 t.Logf("Attempting to create user: %s", name)
lbaas.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 160 lines
16 // random port. An error will be returned if the member could not be created.
17 func CreateMember(t *testing.T, client *gophercloud.ServiceClient, poolID string) (*members.Member, error) {
18 protocolPort := tools.RandomInt(100, 1000)
39 // An error will be returned if the monitor could not be created.
40 func CreateMonitor(t *testing.T, client *gophercloud.ServiceClient) (*monitors.Monitor, error) {
41 t.Logf("Attempting to create monitor.")
62 // if the pool could not be deleted.
63 func CreatePool(t *testing.T, client *gophercloud.ServiceClient, subnetID string) (*pools.Pool, error) {
64 poolName := tools.RandomString("TESTACCT-", 8)
87 // not be created.
88 func CreateVIP(t *testing.T, client *gophercloud.ServiceClient, subnetID, poolID string) (*vips.VirtualIP, error) {
89 vipName := tools.RandomString("TESTACCT-", 8)
114 // function.
115 func DeleteMember(t *testing.T, client *gophercloud.ServiceClient, memberID string) {
116 t.Logf("Attempting to delete member %s", memberID)
env_test.go
(https://github.com/dotcloud/docker.git)
Go · 313 lines
✨ Summary
This is a test file for the Env package in Go. It contains various tests to ensure that the package works correctly and provides the expected functionality. The code includes unit tests, integration tests, and benchmarks to measure the performance of the package.
This is a test file for the Env package in Go. It contains various tests to ensure that the package works correctly and provides the expected functionality. The code includes unit tests, integration tests, and benchmarks to measure the performance of the package.
27 func TestEnvLenDup(t *testing.T) {
28 env := &Env{
39 func TestNewJob(t *testing.T) {
40 job := mkJob(t, "dummy", "--level=awesome")
52 func TestSetenv(t *testing.T) {
53 job := mkJob(t, "dummy")
85 func TestSetenvInt(t *testing.T) {
86 job := mkJob(t, "dummy")
153 for i := 0; i < l; i++ {
154 t := [2]string{testutils.RandomString(5), testutils.RandomString(20)}
155 res[i] = t
authorize_test.go (https://gitlab.com/unofficial-mirrors/mattermost-platform) Go · 147 lines
11 func TestAuthJson(t *testing.T) {
12 a1 := AuthData{}
36 func TestAuthPreSave(t *testing.T) {
37 a1 := AuthData{}
45 func TestAuthIsValid(t *testing.T) {
53 ad.ClientId = NewRandomString(28)
54 if err := ad.IsValid(); err == nil {
63 ad.UserId = NewRandomString(28)
64 if err := ad.IsValid(); err == nil {
manager_test.go (https://gitlab.com/epicglue/epicglue) Go · 396 lines
12 func TestManager_Get(t *testing.T) {
13 now := time.Now()
85 func TestManager_All(t *testing.T) {
86 //now := time.Now()
158 //func TestDefaultDataManager_Channels(t *testing.T) {
159 // //suffix := helpers.RandomString(8)
195 //
196 //func TestDefaultDataManager_Channel(t *testing.T) {
197 // suffix := helpers.RandomString(8)
227 //
228 //func TestDefaultDataManager_CreateChannel(t *testing.T) {
229 // suffix := helpers.RandomString(8)
identity.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 326 lines
20 // unable to be created.
21 func CreateProject(t *testing.T, client *gophercloud.ServiceClient, c *projects.CreateOpts) (*projects.Project, error) {
22 name := tools.RandomString("ACPTTEST", 8)
47 // unable to be created.
48 func CreateUser(t *testing.T, client *gophercloud.ServiceClient, c *users.CreateOpts) (*users.User, error) {
49 name := tools.RandomString("ACPTTEST", 8)
74 // unable to be created.
75 func CreateGroup(t *testing.T, client *gophercloud.ServiceClient, c *groups.CreateOpts) (*groups.Group, error) {
76 name := tools.RandomString("ACPTTEST", 8)
101 // unable to be created.
102 func CreateDomain(t *testing.T, client *gophercloud.ServiceClient, c *domains.CreateOpts) (*domains.Domain, error) {
103 name := tools.RandomString("ACPTTEST", 8)
128 // unable to be created.
129 func CreateRole(t *testing.T, client *gophercloud.ServiceClient, c *roles.CreateOpts) (*roles.Role, error) {
130 name := tools.RandomString("ACPTTEST", 8)
networking.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 246 lines
15 // network could not be created.
16 func CreateNetwork(t *testing.T, client *gophercloud.ServiceClient) (*networks.Network, error) {
17 networkName := tools.RandomString("TESTACC-", 8)
35 // returned if the port could not be created.
36 func CreatePort(t *testing.T, client *gophercloud.ServiceClient, networkID, subnetID string) (*ports.Port, error) {
37 portName := tools.RandomString("TESTACC-", 8)
68 // attached. An error will be returned if the port could not be created.
69 func CreatePortWithNoSecurityGroup(t *testing.T, client *gophercloud.ServiceClient, networkID, subnetID string) (*ports.Port, error) {
70 portName := tools.RandomString("TESTACC-", 8)
103 // will be returned if the subnet could not be created.
104 func CreateSubnet(t *testing.T, client *gophercloud.ServiceClient, networkID string) (*subnets.Subnet, error) {
105 subnetName := tools.RandomString("TESTACC-", 8)
131 // the subnet could not be created.
132 func CreateSubnetWithDefaultGateway(t *testing.T, client *gophercloud.ServiceClient, networkID string) (*subnets.Subnet, error) {
133 subnetName := tools.RandomString("TESTACC-", 8)
rand_test.go (https://gitlab.com/unofficial-mirrors/kubernetes) Go · 114 lines
30 func TestString(t *testing.T) {
31 valid := "0123456789abcdefghijklmnopqrstuvwxyz"
45 // Confirm that panic occurs on invalid input.
46 func TestRangePanic(t *testing.T) {
47 defer func() {
56 func TestIntn(t *testing.T) {
57 // 0 is invalid.
66 func TestPerm(t *testing.T) {
67 Seed(5)
80 func TestIntnRange(t *testing.T) {
81 // 0 is invalid.
fwaas.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 203 lines
17 // policy ID. An error will be returned if the firewall could not be created.
18 func CreateFirewall(t *testing.T, client *gophercloud.ServiceClient, policyID string) (*firewalls.Firewall, error) {
19 firewallName := tools.RandomString("TESTACC-", 8)
47 // returned if the firewall could not be created.
48 func CreateFirewallOnRouter(t *testing.T, client *gophercloud.ServiceClient, policyID string, routerID string) (*firewalls.Firewall, error) {
49 firewallName := tools.RandomString("TESTACC-", 8)
79 // rule. An error will be returned if the rule could not be created.
80 func CreatePolicy(t *testing.T, client *gophercloud.ServiceClient, ruleID string) (*policies.Policy, error) {
81 policyName := tools.RandomString("TESTACC-", 8)
104 // the rule could not be created.
105 func CreateRule(t *testing.T, client *gophercloud.ServiceClient) (*rules.Rule, error) {
106 ruleName := tools.RandomString("TESTACC-", 8)
137 // a deferred function.
138 func DeleteFirewall(t *testing.T, client *gophercloud.ServiceClient, firewallID string) {
139 t.Logf("Attempting to delete firewall: %s", firewallID)
subnets_test.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 158 lines
15 func TestSubnetsList(t *testing.T) {
16 client, err := clients.NewNetworkV2Client()
36 func TestSubnetCRUD(t *testing.T) {
37 client, err := clients.NewNetworkV2Client()
58 // Update Subnet
59 newSubnetName := tools.RandomString("TESTACC-", 8)
60 updateOpts := subnets.UpdateOpts{
77 func TestSubnetsDefaultGateway(t *testing.T) {
78 client, err := clients.NewNetworkV2Client()
118 func TestSubnetsNoGateway(t *testing.T) {
119 client, err := clients.NewNetworkV2Client()
EditInlineTest.java (https://github.com/ntallapa/xwiki-enterprise.git) Java · 132 lines
22 import org.apache.commons.lang.RandomStringUtils;
23 import org.junit.Assert;
55 {
56 String title = RandomStringUtils.randomAlphanumeric(4);
57 getUtil().gotoPage("EditInlineTest", "testInlineEditCanChangeTitle", "inline", "title=" + title);
74 {
75 String title = RandomStringUtils.randomAlphanumeric(4);
76 getUtil().gotoPage("EditInlineTest", "testInlineEditPreservesTitle", "save", "title=" + title);
99 {
100 String tag1 = RandomStringUtils.randomAlphanumeric(4);
101 String tag2 = RandomStringUtils.randomAlphanumeric(4);
blockstorage.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 142 lines
17 // error will be returned if the volume was unable to be created.
18 func CreateVolume(t *testing.T, client *gophercloud.ServiceClient) (*volumes.Volume, error) {
19 if testing.Short() {
23 volumeName := tools.RandomString("ACPTTEST", 16)
24 t.Logf("Attempting to create volume: %s", volumeName)
45 // 1GB. An error will be returned if the volume was unable to be created.
46 func CreateVolumeFromImage(t *testing.T, client *gophercloud.ServiceClient) (*volumes.Volume, error) {
47 if testing.Short() {
56 volumeName := tools.RandomString("ACPTTEST", 16)
57 t.Logf("Attempting to create volume: %s", volumeName)
79 // failed to be deleted. This works best when used as a deferred function.
80 func DeleteVolume(t *testing.T, client *gophercloud.ServiceClient, volume *volumes.Volume) {
81 err := volumes.Delete(client, volume.ID).ExtractErr()
subscription_integration_test.go (https://gitlab.com/epicglue/api) Go · 164 lines
17 // Subscriptions
18 func TestSubscriptionsWithIncorrectInput(t *testing.T) {
19 client := http.Client{}
31 //func TestSubscriptions(t *testing.T) {
32 // client := http.Client{}
48 //// Subscribe
49 //func subscribeWithPayload(t *testing.T, payload map[string]interface{}) {
50 // client := http.Client{}
63 //
64 //func TestSubscribePerUserWithValue(t *testing.T) {
65 // numberOfSubs := howManySubscriptionsUserHas(USER_ID)
69 // "profile_id": PROFILE_ID,
70 // "value": helpers.RandomString(8),
71 // }
dns.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 164 lines
13 // be returned if the zone was unable to be created.
14 func CreateRecordSet(t *testing.T, client *gophercloud.ServiceClient, zone *zones.Zone) (*recordsets.RecordSet, error) {
15 t.Logf("Attempting to create recordset: %s", zone.Name)
45 // be returned if the zone was unable to be created.
46 func CreateZone(t *testing.T, client *gophercloud.ServiceClient) (*zones.Zone, error) {
47 zoneName := tools.RandomString("ACPTTEST", 8) + ".com."
79 // This is only for example purposes as it will try to do a zone transfer.
80 func CreateSecondaryZone(t *testing.T, client *gophercloud.ServiceClient) (*zones.Zone, error) {
81 zoneName := tools.RandomString("ACPTTEST", 8) + ".com."
110 // function.
111 func DeleteRecordSet(t *testing.T, client *gophercloud.ServiceClient, rs *recordsets.RecordSet) {
112 err := recordsets.Delete(client, rs.ZoneID, rs.ID).ExtractErr()
122 // function.
123 func DeleteZone(t *testing.T, client *gophercloud.ServiceClient, zone *zones.Zone) {
124 _, err := zones.Delete(client, zone.ID).Extract()
routers_test.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 119 lines
15 func TestLayer3RouterList(t *testing.T) {
16 client, err := clients.NewNetworkV2Client()
37 func TestLayer3ExternalRouterCreateDelete(t *testing.T) {
38 client, err := clients.NewNetworkV2Client()
51 newName := tools.RandomString("TESTACC-", 8)
52 updateOpts := routers.UpdateOpts{
69 func TestLayer3RouterInterface(t *testing.T) {
70 client, err := clients.NewNetworkV2Client()
user_integration_test.go (https://gitlab.com/epicglue/api) Go · 124 lines
13 //func TestMe(t *testing.T) {
14 // client := http.Client{}
34 func TestLoginByWrongEmail(t *testing.T) {
35 client := http.Client{}
50 func TestLoginByEmail(t *testing.T) {
51 client := http.Client{}
70 func TestRegisterByExistingEmail(t *testing.T) {
71 client := http.Client{}
86 func TestRegisterByWrongEmail(t *testing.T) {
87 client := http.Client{}
ports_test.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 349 lines
14 func TestPortsList(t *testing.T) {
15 client, err := clients.NewNetworkV2Client()
35 func TestPortsCRUD(t *testing.T) {
36 client, err := clients.NewNetworkV2Client()
68 // Update port
69 newPortName := tools.RandomString("TESTACC-", 8)
70 updateOpts := ports.UpdateOpts{
81 func TestPortsRemoveSecurityGroups(t *testing.T) {
82 client, err := clients.NewNetworkV2Client()
142 func TestPortsDontAlterSecurityGroups(t *testing.T) {
143 client, err := clients.NewNetworkV2Client()
objects_test.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 257 lines
20 func TestObjects(t *testing.T) {
21 client, err := clients.NewObjectStorageV1Client()
28 for i := 0; i < len(oNames); i++ {
29 oNames[i] = tools.RandomString("test-object-", 8)
30 }
32 // Create a container to hold the test objects.
33 cName := tools.RandomString("test-container-", 8)
34 header, err := containers.Create(client, cName, nil).Extract()
46 for i := 0; i < numObjects; i++ {
47 oContents[i] = bytes.NewBuffer([]byte(tools.RandomString("", 10)))
48 createOpts := objects.CreateOpts{
140 func TestObjectsListSubdir(t *testing.T) {
141 client, err := clients.NewObjectStorageV1Client()
volumeattach_test.go (https://gitlab.com/Red54/machine) Go · 130 lines
22 func newBlockClient(t *testing.T) (*gophercloud.ServiceClient, error) {
23 ao, err := rackspace.AuthOptionsFromEnv()
34 func createVAServer(t *testing.T, computeClient *gophercloud.ServiceClient, choices *serverOpts) (*osServers.Server, error) {
35 if testing.Short() {
39 name := tools.RandomString("ACPTTEST", 16)
40 t.Logf("Attempting to create server: %s\n", name)
59 func createVAVolume(t *testing.T, blockClient *gophercloud.ServiceClient) (*volumes.Volume, error) {
60 volume, err := volumes.Create(blockClient, &osVolumes.CreateOpts{
73 func createVolumeAttachment(t *testing.T, computeClient *gophercloud.ServiceClient, blockClient *gophercloud.ServiceClient, serverID string, volumeID string) {
74 va, err := volumeattach.Create(computeClient, serverID, &osVolumeAttach.CreateOpts{
metric_test.go (https://gitlab.com/verminio/gofw) Go · 82 lines
floatingip_test.go (https://gitlab.com/Red54/machine) Go · 107 lines
16 func createFIPServer(t *testing.T, client *gophercloud.ServiceClient, choices *ComputeChoices) (*servers.Server, error) {
17 if testing.Short() {
21 name := tools.RandomString("ACPTTEST", 16)
22 t.Logf("Attempting to create server: %s\n", name)
41 func createFloatingIP(t *testing.T, client *gophercloud.ServiceClient) (*floatingip.FloatingIP, error) {
42 pool := os.Getenv("OS_POOL_NAME")
52 func associateFloatingIP(t *testing.T, client *gophercloud.ServiceClient, serverId string, fip *floatingip.FloatingIP) {
53 err := floatingip.Associate(client, serverId, fip.IP).ExtractErr()
66 func TestFloatingIP(t *testing.T) {
67 pool := os.Getenv("OS_POOL_NAME")
imageservice.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 55 lines
14 // An error will be returned if an image was unable to be created.
15 func CreateEmptyImage(t *testing.T, client *gophercloud.ServiceClient) (*images.Image, error) {
16 var image *images.Image
18 name := tools.RandomString("ACPTTEST", 16)
19 t.Logf("Attempting to create image: %s", name)
47 // used as a deferred function.
48 func DeleteImage(t *testing.T, client *gophercloud.ServiceClient, image *images.Image) {
49 err := images.Delete(client, image.ID).ExtractErr()
containers_test.go (https://gitlab.com/Red54/machine) Go · 137 lines
18 func TestContainers(t *testing.T) {
19 // Create a new client to execute the HTTP requests. See common.go for newClient body.
24 for i := 0; i < numContainers; i++ {
25 cNames[i] = tools.RandomString("gophercloud-test-container-", 8)
26 }
91 func TestListAllContainers(t *testing.T) {
92 // Create a new client to execute the HTTP requests. See common.go for newClient body.
99 for i := 0; i < numContainers; i++ {
100 cNames[i] = tools.RandomString("gophercloud-test-container-", 8)
101 }
containers_test.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 146 lines
19 func TestContainers(t *testing.T) {
20 client, err := clients.NewObjectStorageV1Client()
27 for i := 0; i < numContainers; i++ {
28 cNames[i] = tools.RandomString("gophercloud-test-container-", 8)
29 }
98 func TestListAllContainers(t *testing.T) {
99 client, err := clients.NewObjectStorageV1Client()
108 for i := 0; i < numContainers; i++ {
109 cNames[i] = tools.RandomString("gophercloud-test-container-", 8)
110 }
user_test.go (https://gitlab.com/JamesClonk/machine) Go · 93 lines
17 func TestUsers(t *testing.T) {
18 client := authenticatedClient(t)
33 func createUser(t *testing.T, client *gophercloud.ServiceClient) string {
34 t.Log("Creating user")
36 opts := users.CreateOpts{
37 Username: tools.RandomString("user_", 5),
38 Enabled: os.Disabled,
49 func listUsers(t *testing.T, client *gophercloud.ServiceClient) {
50 err := users.List(client).EachPage(func(page pagination.Page) (bool, error) {
65 func getUser(t *testing.T, client *gophercloud.ServiceClient, userID string) {
66 _, err := users.Get(client, userID).Extract()
blockstorage.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 142 lines
18 // created.
19 func CreateSnapshot(t *testing.T, client *gophercloud.ServiceClient, volume *volumes.Volume) (*snapshots.Snapshot, error) {
20 if testing.Short() {
24 snapshotName := tools.RandomString("ACPTTEST", 16)
25 t.Logf("Attempting to create snapshot %s based on volume %s", snapshotName, volume.ID)
46 // error will be returned if the volume was unable to be created.
47 func CreateVolume(t *testing.T, client *gophercloud.ServiceClient) (*volumes.Volume, error) {
48 if testing.Short() {
52 volumeName := tools.RandomString("ACPTTEST", 16)
53 t.Logf("Attempting to create volume: %s", volumeName)
74 // be returned if the volume type was unable to be created.
75 func CreateVolumeType(t *testing.T, client *gophercloud.ServiceClient) (*volumetypes.VolumeType, error) {
76 volumeTypeName := tools.RandomString("ACPTTEST", 16)
AddRemoveTagsTest.java (https://github.com/ntallapa/xwiki-enterprise.git) Java · 193 lines
24 import org.apache.commons.lang.RandomStringUtils;
25 import org.junit.Before;
61 {
62 String tag = RandomStringUtils.randomAlphanumeric(4);
63 Assert.assertFalse(taggablePage.hasTag(tag));
77 {
78 String firstTag = RandomStringUtils.randomAlphanumeric(4);
79 Assert.assertFalse(taggablePage.hasTag(firstTag));
84 String secondTag = RandomStringUtils.randomAlphanumeric(4);
85 Assert.assertFalse(taggablePage.hasTag(secondTag));
138 {
139 String tag = RandomStringUtils.randomAlphanumeric(3) + "|" + RandomStringUtils.randomAlphanumeric(3);
140 Assert.assertFalse(taggablePage.hasTag(tag));
securityservices.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 60 lines
12 // error will be returned if the security service was unable to be created.
13 func CreateSecurityService(t *testing.T, client *gophercloud.ServiceClient) (*securityservices.SecurityService, error) {
14 if testing.Short() {
18 securityServiceName := tools.RandomString("ACPTTEST", 16)
19 t.Logf("Attempting to create security service: %s", securityServiceName)
35 // the security service was unable to be deleted.
36 func DeleteSecurityService(t *testing.T, client *gophercloud.ServiceClient, securityService *securityservices.SecurityService) {
37 err := securityservices.Delete(client, securityService.ID).ExtractErr()
45 // PrintSecurityService will print a security service and all of its attributes.
46 func PrintSecurityService(t *testing.T, securityService *securityservices.SecurityService) {
47 t.Logf("ID: %s", securityService.ID)
tenantnetworks_test.go (https://gitlab.com/Red54/machine) Go · 109 lines
16 func getNetworkID(t *testing.T, client *gophercloud.ServiceClient, networkName string) (string, error) {
17 allPages, err := tenantnetworks.List(client).AllPages()
40 func createNetworkServer(t *testing.T, client *gophercloud.ServiceClient, choices *ComputeChoices, networkID string) (*servers.Server, error) {
41 if testing.Short() {
45 name := tools.RandomString("ACPTTEST", 16)
46 t.Logf("Attempting to create server: %s\n", name)
71 func TestTenantNetworks(t *testing.T) {
72 networkName := os.Getenv("OS_NETWORK_NAME")
sharenetworks.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 60 lines
12 // error will be returned if the share network was unable to be created.
13 func CreateShareNetwork(t *testing.T, client *gophercloud.ServiceClient) (*sharenetworks.ShareNetwork, error) {
14 if testing.Short() {
18 shareNetworkName := tools.RandomString("ACPTTEST", 16)
19 t.Logf("Attempting to create share network: %s", shareNetworkName)
35 // the share network was unable to be deleted.
36 func DeleteShareNetwork(t *testing.T, client *gophercloud.ServiceClient, shareNetwork *sharenetworks.ShareNetwork) {
37 err := sharenetworks.Delete(client, shareNetwork.ID).ExtractErr()
45 // PrintShareNetwork will print a share network and all of its attributes.
46 func PrintShareNetwork(t *testing.T, sharenetwork *sharenetworks.ShareNetwork) {
47 t.Logf("ID: %s", sharenetwork.ID)
user_test.go (https://gitlab.com/Red54/machine) Go · 127 lines
17 func TestUsers(t *testing.T) {
18 client := authenticatedClient(t)
35 func findTenant(t *testing.T, client *gophercloud.ServiceClient) string {
36 var tenantID string
53 func createUser(t *testing.T, client *gophercloud.ServiceClient, tenantID string) string {
54 t.Log("Creating user")
56 opts := users.CreateOpts{
57 Name: tools.RandomString("user_", 5),
58 Enabled: users.Disabled,
70 func listUsers(t *testing.T, client *gophercloud.ServiceClient) {
71 err := users.List(client).EachPage(func(page pagination.Page) (bool, error) {
volumeattach_test.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 78 lines
14 func TestVolumeAttachAttachment(t *testing.T) {
15 if testing.Short() {
55 func createVolume(t *testing.T, blockClient *gophercloud.ServiceClient) (*volumes.Volume, error) {
56 volumeName := tools.RandomString("ACPTTEST", 16)
71 func deleteVolume(t *testing.T, blockClient *gophercloud.ServiceClient, volume *volumes.Volume) {
72 err := volumes.Delete(blockClient, volume.ID).ExtractErr()
counter_integration_test.go (https://gitlab.com/epicglue/api) Go · 125 lines
sharetypes.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 56 lines
12 // error will be returned if the share type was unable to be created.
13 func CreateShareType(t *testing.T, client *gophercloud.ServiceClient) (*sharetypes.ShareType, error) {
14 if testing.Short() {
18 shareTypeName := tools.RandomString("ACPTTEST", 16)
19 t.Logf("Attempting to create share type: %s", shareTypeName)
40 // the share type was unable to be deleted.
41 func DeleteShareType(t *testing.T, client *gophercloud.ServiceClient, shareType *sharetypes.ShareType) {
42 err := sharetypes.Delete(client, shareType.ID).ExtractErr()
50 // PrintShareType will print a share type and all of its attributes.
51 func PrintShareType(t *testing.T, shareType *sharetypes.ShareType) {
52 t.Logf("Name: %s", shareType.Name)
objects_test.go (https://gitlab.com/Red54/machine) Go · 119 lines
20 func TestObjects(t *testing.T) {
21 // Create a provider client for executing the HTTP request.
27 for i := 0; i < len(oNames); i++ {
28 oNames[i] = tools.RandomString("test-object-", 8)
29 }
31 // Create a container to hold the test objects.
32 cName := tools.RandomString("test-container-", 8)
33 header, err := containers.Create(client, cName, nil).ExtractHeader()
45 for i := 0; i < numObjects; i++ {
46 oContents[i] = bytes.NewBuffer([]byte(tools.RandomString("", 10)))
47 res := objects.Create(client, cName, oNames[i], oContents[i], nil)
service_integration_test.go (https://gitlab.com/epicglue/api) Go · 111 lines
18 "service_user_id": fmt.Sprintf("%d", helpers.RandomNumber(16)),
19 "token": helpers.RandomString(32),
20 "username": "John Doe",
43 func TestConnectServiceUnauthorized(t *testing.T) {
44 client := http.Client{}
56 //func TestConnectServiceInvalidRequest(t *testing.T) {
57 // client := http.Client{}
68 //
69 //func TestConnectServiceEmptyToken(t *testing.T) {
70 // testRequest := getTestRequest()
84 //
85 //func TestConnectServiceInvalidService(t *testing.T) {
86 // testRequest := getTestRequest()
random_test.go (https://gitlab.com/shinvdu/syncthing) Go · 63 lines
11 func TestSeedFromBytes(t *testing.T) {
12 // should always return the same seed for the same bytes
28 func TestRandomString(t *testing.T) {
29 for _, l := range []int{0, 1, 2, 3, 4, 8, 42} {
30 s := RandomString(l)
31 if len(s) != l {
37 for i := range strings {
38 strings[i] = RandomString(8)
39 for j := range strings {
50 func TestRandomInt64(t *testing.T) {
51 ints := make([]int64, 1000)
keypairs_test.go (https://gitlab.com/Red54/machine) Go · 87 lines
16 func deleteKeyPair(t *testing.T, client *gophercloud.ServiceClient, name string) {
17 err := keypairs.Delete(client, name).ExtractErr()
22 func TestCreateKeyPair(t *testing.T) {
23 client, err := newClient()
26 name := tools.RandomString("createdkey-", 8)
27 k, err := keypairs.Create(client, os.CreateOpts{Name: name}).Extract()
39 func TestImportKeyPair(t *testing.T) {
40 client, err := newClient()
43 name := tools.RandomString("importedkey-", 8)
44 pubkey := "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDlIQ3r+zd97kb9Hzmujd3V6pbO53eb3Go4q2E8iqVGWQfZTrFdL9KACJnqJIm9HmncfRkUTxE37hqeGCCv8uD+ZPmPiZG2E60OX1mGDjbbzAyReRwYWXgXHopggZTLak5k4mwZYaxwaufbVBDRn847e01lZnaXaszEToLM37NLw+uz29sl3TwYy2R0RGHPwPc160aWmdLjSyd1Nd4c9pvvOP/EoEuBjIC6NJJwg2Rvg9sjjx9jYj0QUgc8CqKLN25oMZ69kNJzlFylKRUoeeVr89txlR59yehJWk6Uw6lYFTdJmcmQOFVAJ12RMmS1hLWCM8UzAgtw+EDa0eqBxBDl smash@winter"
utils_test.go (https://code.google.com/p/sortingo/) Go · 296 lines
40 // randomStrings consists of strings of 100 mixed-case letters and numbers.
41 var randomStrings []string
72 // Generate a set of random strings, each of length 100.
73 randomStrings = make([]string, largeDataSize)
74 for i := range randomStrings {
85 }
86 randomStrings[i] = string(bb.Bytes())
87 }
140 // basic of input sequences in order to test its robustness.
141 func testSortArguments(t *testing.T, f func([]string)) {
142 // these should silently do nothing
170 // repeated strings.
171 func testSortRepeated(t *testing.T, f func([]string), size int) {
172 checkTestSize(t, size)
tools.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 73 lines
32 func MakeNewPassword(oldPass string) string {
33 randomPassword := RandomString("", 16)
34 for randomPassword == oldPass {
35 randomPassword = RandomString("", 16)
36 }
40 // RandomString generates a string of given length, but random content.
41 // All content will be within the ASCII graphic character set.
43 // http://stackoverflow.com/questions/12771930/what-is-the-fastest-way-to-generate-a-long-random-string-in-go).
44 func RandomString(prefix string, n int) string {
45 const alphanum = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
69 // PrintResource returns a resource as a readable structure
70 func PrintResource(t *testing.T, resource interface{}) {
71 b, _ := json.MarshalIndent(resource, "", " ")
containers_test.go (https://gitlab.com/JamesClonk/machine) Go · 89 lines
bootfromvolume_test.go (https://gitlab.com/JamesClonk/machine) Go · 55 lines
keypairs_test.go (https://gitlab.com/JamesClonk/machine) Go · 74 lines
create_index_integration_test.go (https://gitlab.com/epicglue/api) Go · 28 lines
random_test.go (https://gitlab.com/0072016/syncthing) Go · 63 lines
access_test.go (https://gitlab.com/unofficial-mirrors/mattermost-platform) Go · 97 lines
11 func TestAccessJson(t *testing.T) {
12 a1 := AccessData{}
26 func TestAccessIsValid(t *testing.T) {
27 ad := AccessData{}
33 ad.ClientId = NewRandomString(28)
34 if err := ad.IsValid(); err == nil {
48 ad.UserId = NewRandomString(28)
49 if err := ad.IsValid(); err == nil {
63 ad.Token = NewRandomString(22)
64 if err := ad.IsValid(); err == nil {
volumeattach_test.go (https://gitlab.com/Red54/machine) Go · 125 lines
18 func newBlockClient(t *testing.T) (*gophercloud.ServiceClient, error) {
19 ao, err := openstack.AuthOptionsFromEnv()
30 func createVAServer(t *testing.T, computeClient *gophercloud.ServiceClient, choices *ComputeChoices) (*servers.Server, error) {
31 if testing.Short() {
35 name := tools.RandomString("ACPTTEST", 16)
36 t.Logf("Attempting to create server: %s\n", name)
55 func createVAVolume(t *testing.T, blockClient *gophercloud.ServiceClient) (*volumes.Volume, error) {
56 volume, err := volumes.Create(blockClient, &volumes.CreateOpts{
69 func createVolumeAttachment(t *testing.T, computeClient *gophercloud.ServiceClient, blockClient *gophercloud.ServiceClient, serverId string, volumeId string) {
70 va, err := volumeattach.Create(computeClient, serverId, &volumeattach.CreateOpts{
user_access_token_test.go (https://gitlab.com/unofficial-mirrors/mattermost-platform) Go · 58 lines
11 func TestUserAccessTokenJson(t *testing.T) {
12 a1 := UserAccessToken{}
32 func TestUserAccessTokenIsValid(t *testing.T) {
33 ad := UserAccessToken{}
39 ad.Id = NewRandomString(26)
40 if err := ad.IsValid(); err == nil || err.Id != "model.user_access_token.is_valid.token.app_error" {
44 ad.Token = NewRandomString(26)
45 if err := ad.IsValid(); err == nil || err.Id != "model.user_access_token.is_valid.user_id.app_error" {
49 ad.UserId = NewRandomString(26)
50 if err := ad.IsValid(); err != nil {
remotevalue_test.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 36 lines
10 func TestRemoteValueGenerator(t *testing.T) {
11 generator := NewRemoteValueGenerator()
19 func TestFakeRemoteValueGenerator(t *testing.T) {
20 // Run the fake remote server
21 http.HandleFunc("/v1/value/generate", func(w http.ResponseWriter, r *http.Request) {
22 fmt.Fprintf(w, "NewRandomString")
23 })
32 }
33 if value != "NewRandomString" {
34 t.Errorf("Failed to fetch remote value using GET.")
subnetpools.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 45 lines
12 // subnetpool could not be created.
13 func CreateSubnetPool(t *testing.T, client *gophercloud.ServiceClient) (*subnetpools.SubnetPool, error) {
14 subnetPoolName := tools.RandomString("TESTACC-", 8)
35 // A fatal error will occur if the delete was not successful.
36 func DeleteSubnetPool(t *testing.T, client *gophercloud.ServiceClient, subnetPoolID string) {
37 t.Logf("Attempting to delete the subnetpool: %s", subnetPoolID)
blockstorage.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 107 lines
16 // error will be returned if the volume was unable to be created.
17 func CreateVolume(t *testing.T, client *gophercloud.ServiceClient) (*volumes.Volume, error) {
18 if testing.Short() {
22 volumeName := tools.RandomString("ACPTTEST", 16)
23 t.Logf("Attempting to create volume: %s", volumeName)
44 // failed to be deleted. This works best when used as a deferred function.
45 func DeleteVolume(t *testing.T, client *gophercloud.ServiceClient, volume *volumes.Volume) {
46 err := volumes.Delete(client, volume.ID).ExtractErr()
55 // Snapshot will be assigned a random name and description.
56 func CreateSnapshot(t *testing.T, client *gophercloud.ServiceClient, volume *volumes.Volume) (*snapshots.Snapshot, error) {
57 if testing.Short() {
61 snapshotName := tools.RandomString("ACPTTEST", 16)
62 snapshotDescription := tools.RandomString("ACPTTEST", 16)
credentials_test.go (https://gitlab.com/admin-github-cloud/dex) Go · 53 lines
13 func TestGetCredentials(t *testing.T) {
14 domain := reqEnv(t, "MG_DOMAIN")
31 func TestCreateDeleteCredentials(t *testing.T) {
32 domain := reqEnv(t, "MG_DOMAIN")
34 mg := mailgun.NewMailgun(domain, apiKey, "")
35 randomPassword := randomString(16, "pw")
36 randomID := randomString(16, "usr")
44 err = mg.ChangeCredentialPassword(randomID, randomString(16, "pw2"))
45 if err != nil {
create_user_integration_test.go (https://gitlab.com/epicglue/api) Go · 43 lines
store_feedback_integration_test.go (https://gitlab.com/epicglue/api) Go · 31 lines
resource_aws_db_parameter_group_test.go (https://gitlab.com/biopandemic/terraform.git) Go · 302 lines
16 func TestAccAWSDBParameterGroup_basic(t *testing.T) {
17 var v rds.DBParameterGroup
86 func TestAccAWSDBParameterGroupOnly(t *testing.T) {
87 var v rds.DBParameterGroup
111 func TestResourceAWSDBParameterGroupName_validation(t *testing.T) {
112 cases := []struct {
136 {
137 Value: randomString(256),
138 ErrCount: 1,
238 func randomString(strlen int) string {
239 rand.Seed(time.Now().UTC().UnixNano())
Utils.java (https://bitbucket.org/aimylos/blockchainj.git) Java · 190 lines
AddNewUserGroup.xaml.cs (https://bitbucket.org/koitkorvel/teliaprojectunifi.git) C# · 110 lines
28 static List<JsonUserGroups> userGroupList = new List<JsonUserGroups>();
29 const String randomStringGenerator = "abcdefghijklmnopqrstuvwxyz0123456789";
30 private static Random random = new Random((int)DateTime.Now.Ticks);
49 }
50 private static string RandomStringGenerator(int length)
51 {
54 {
55 var c = randomStringGenerator[random.Next(0, randomStringGenerator.Length)];
56 randomBuilder.Append(c);
82 {
83 _id = RandomStringGenerator(25),
84 name = UserGroupNameTextBox.Text,
AbstractTaskTestCase.java (https://github.com/ALRubinger/wildfly.git) Java · 113 lines
29 import static org.jboss.as.patching.IoUtils.mkdir;
30 import static org.jboss.as.patching.runner.TestUtils.randomString;
61 public void setup() throws Exception {
62 tempDir = mkdir(new File(System.getProperty("java.io.tmpdir")), "patching-" + randomString());
63 File jbossHome = mkdir(tempDir, "jboss-installation");
KickstartScriptActionTest.java (https://github.com/colloquium/spacewalk.git) Java · 151 lines
24 import org.apache.commons.lang.RandomStringUtils;
46 public void testExecuteLargeValueSubmit() throws Exception {
47 String contents = RandomStringUtils.randomAscii(400000);
48 // Lets zero out the scripts
66 contents = RandomStringUtils.randomAscii(50000);
67 addRequestParameter(KickstartScriptCreateAction.CONTENTS,
116 public void testEditExecuteSubmit() throws Exception {
117 String contents = "some script value " + TestUtils.randomString();
118 String language = "/usr/bin/perl";
tst_test.go (git://github.com/badgerodon/collections.git) Go · 83 lines
DDMFormTestUtil.java (https://github.com/natecavanaugh/liferay-portal.git) Java · 283 lines
MQClient.java (https://gitlab.com/intruxxer/PointRedemptionApp.git) Java · 126 lines
UpdateSegmentsContextVocabularyConfigurationMVCActionCommandTest.java (https://github.com/mhan810/liferay-portal.git) Java · 241 lines
75 public void testProcessAction() throws Exception {
76 String entityField = RandomTestUtil.randomString();
79 _getMockLiferayPortletActionRequest(
80 RandomTestUtil.randomString(), entityField, null);
100 public void testProcessActionWithDuplicatedEntityField() throws Exception {
101 String entityField = RandomTestUtil.randomString();
104 _getMockLiferayPortletActionRequest(
105 RandomTestUtil.randomString(), entityField, null);
111 mockLiferayPortletActionRequest = _getMockLiferayPortletActionRequest(
112 RandomTestUtil.randomString(), entityField, null);
pubsub_test.go (https://gitlab.com/sika-forks/go-redis.git) Go · 83 lines
fs_test.go (https://github.com/dotcloud/docker.git) Go · 122 lines
10 func abs(t *testing.T, p string) string {
11 o, err := filepath.Abs(p)
18 func TestFollowSymLinkNormal(t *testing.T) {
19 link := "testdata/fs/a/d/c/data"
31 func TestFollowSymLinkRelativePath(t *testing.T) {
32 link := "testdata/fs/i"
44 func TestFollowSymLinkUnderLinkedDir(t *testing.T) {
45 dir, err := ioutil.TempDir("", "docker-fs-test")
67 func TestFollowSymLinkRandomString(t *testing.T) {
68 if _, err := FollowSymlinkInScope("toto", "testdata"); err == nil {
testutils.go (https://github.com/dotcloud/docker.git) Go · 38 lines
init_test.go (https://github.com/dotcloud/docker.git) Go · 43 lines
networks_test.go (https://bitbucket.org/enterstudiosbiz/origin.git) Go · 65 lines
BenchmarkTests.cs (https://bitbucket.org/d3/d3cqrs) C# · 226 lines
random_test.go (https://gitlab.com/steamdriven80/syncthing.git) Go · 78 lines
16 func TestPredictableRandom(t *testing.T) {
17 predictableRandomTest.Do(func() {
26 func TestSeedFromBytes(t *testing.T) {
27 // should always return the same seed for the same bytes
43 func TestRandomString(t *testing.T) {
44 for _, l := range []int{0, 1, 2, 3, 4, 8, 42} {
45 s := randomString(l)
46 if len(s) != l {
52 for i := range strings {
53 strings[i] = randomString(8)
54 for j := range strings {
ad_proxy_admin_test.go (https://bitbucket.org/matchmove/go-commons.git) Go · 122 lines
22 func Test_PostActivityNoRequestError(t *testing.T) {
37 func Test_PostActivityNoRequestSuccess(t *testing.T) {
54 func Test_PostStoreSuccess(t *testing.T) {
63 Mobile: strconv.Itoa(rand.Intn(100000000)),
64 UserHashID: "userms_hashid_new1" + secure.RandomString(5, []rune(secure.RuneAlpha)),
65 }
78 func Test_PutUpdateSuccess(t *testing.T) {
apps_test.go (https://gitlab.com/seacoastboy/deis.git) Go · 119 lines
24 func randomString(n int) string {
25 var letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
33 func TestApps(t *testing.T) {
34 params := appsSetup(t)
45 func appsSetup(t *testing.T) *utils.DeisTestConfig {
46 cfg := utils.GetGlobalConfig()
53 func appsCreateTest(t *testing.T, params *utils.DeisTestConfig) {
54 wd, _ := os.Getwd()
64 func appsDestroyTest(t *testing.T, params *utils.DeisTestConfig) {
65 if err := utils.Chdir(params.ExampleApp); err != nil {
objects_test.go (https://bitbucket.org/enterstudiosbiz/origin.git) Go · 138 lines
20 func TestObjects(t *testing.T) {
21 client, err := clients.NewObjectStorageV1Client()
28 for i := 0; i < len(oNames); i++ {
29 oNames[i] = tools.RandomString("test-object-", 8)
30 }
32 // Create a container to hold the test objects.
33 cName := tools.RandomString("test-container-", 8)
34 header, err := containers.Create(client, cName, nil).Extract()
46 for i := 0; i < numObjects; i++ {
47 oContents[i] = bytes.NewBuffer([]byte(tools.RandomString("", 10)))
48 createOpts := objects.CreateOpts{
portsbinding_test.go (https://bitbucket.org/enterstudiosbiz/origin.git) Go · 58 lines
upid_test.go (https://gitlab.com/silenteh/mesos-go) Go · 64 lines
11 func generateRandomString() string {
12 b := make([]byte, rand.Intn(1024))
19 func TestUPIDParse(t *testing.T) {
20 u, err := Parse("mesos@foo:bar")
33 for i := 0; i < 100000; i++ {
34 ra := generateRandomString()
35 u, err = Parse(ra)
45 func TestUPIDString(t *testing.T) {
46 u, err := Parse("mesos@localhost:5050")
52 func TestUPIDEqual(t *testing.T) {
53 u1, err := Parse("mesos@localhost:5050")
utils_test.go (https://gitlab.com/Realtyka/platform) Go · 122 lines
11 func TestNewId(t *testing.T) {
12 for i := 0; i < 1000; i++ {
20 func TestRandomString(t *testing.T) {
21 for i := 0; i < 1000; i++ {
22 r := NewRandomString(32)
23 if len(r) != 32 {
29 func TestAppError(t *testing.T) {
30 err := NewLocAppError("TestAppError", "message", nil, "")
40 func TestMapJson(t *testing.T) {
client_test.go (https://bitbucket.org/afawkes/acs-engine.git) Go · 342 lines
17 func TestLoggingInspectorWithInspection(t *testing.T) {
18 b := bytes.Buffer{}
31 func TestLoggingInspectorWithInspectionEmitsErrors(t *testing.T) {
32 b := bytes.Buffer{}
48 func TestLoggingInspectorWithInspectionRestoresBody(t *testing.T) {
49 b := bytes.Buffer{}
64 func TestLoggingInspectorByInspecting(t *testing.T) {
65 b := bytes.Buffer{}
78 func TestLoggingInspectorByInspectingEmitsErrors(t *testing.T) {
79 b := bytes.Buffer{}
PatchConflictsUnitTestCase.java (https://github.com/wolfc/jboss-as.git) Java · 88 lines
27 import static org.jboss.as.patching.runner.TestUtils.createModule0;
28 import static org.jboss.as.patching.runner.TestUtils.randomString;
29 import static org.jboss.as.patching.tool.PatchTool.Factory.policyBuilder;
66 final File base = builder.getFile("modules", "system", "layers", "base");
67 createModule0(base, "org.jboss.test", randomString());
handlers_test.go (https://bitbucket.org/rick-chang/user.service.git) Go · 209 lines
22 func TestGetAllUsers(t *testing.T) {
23 req := httptest.NewRequest(http.MethodGet, "/user/all", nil)
38 func TestGetOneUser(t *testing.T) {
39 // 测试正常响应
68 func TestAddUser(t *testing.T) {
69 // username 为空的情况
88 form := make(url.Values)
89 form.Add("name", "rand_name"+randomString(3))
90 form.Add("password", "")
106 form := make(url.Values)
107 form.Add("name", "rand_name"+randomString(3))
108 form.Add("password", "111111")
consul_test.go (https://github.com/xing/beetle.git) Go · 89 lines
17 var testApp = "beetle"
18 var testToken = "randomstring"
40 func TestConnect(t *testing.T) {
41 client := NewClient(testUrl, testToken, testApp)
49 }
50 func TestState(t *testing.T) {
51 client := NewClient(testUrl, testToken, testApp)
66 func TestWatching(t *testing.T) {
67 client := NewClient(testUrl, testToken, testApp)
BenchmarkTests.cs (https://github.com/ServiceStack/ServiceStack.git) C# · 281 lines
generate_test.go (https://codeberg.org/tklein23/gogs-gitea.git) Go · 20 lines
processutil_test.go (https://github.com/APTrust/bagman.git) Go · 173 lines
27 func TestNewProcessUtil(t *testing.T) {
28 procUtil := bagman.NewProcessUtil(&testConfig)
56 func TestIncrementSucceededAndFailed(t *testing.T) {
57 procUtil := bagman.NewProcessUtil(&testConfig)
75 func TestMessageIdString(t *testing.T) {
76 procUtil := bagman.NewProcessUtil(&testConfig)
86 func TestSyncMapFunctions(t *testing.T) {
87 procUtil := bagman.NewProcessUtil(&testConfig)
134 func TestBagAlreadyInProgress(t *testing.T) {
135 procUtil := bagman.NewProcessUtil(&testConfig)