| 1 | package ram |
| 2 | |
| 3 | import ( |
| 4 | "testing" |
| 5 | ) |
| 6 | |
| 7 | var ( |
| 8 | password = "hello&world" |
| 9 | passwordNew = "hello&world&new" |
| 10 | userName string |
| 11 | ) |
| 12 | |
| 13 | func TestCreateLoginProfile(t *testing.T) { |
| 14 | client := NewTestClient() |
| 15 | listParams := ListUserRequest{} |
| 16 | resp, err := client.ListUsers(listParams) |
| 17 | if err != nil { |
| 18 | t.Errorf("Failed to ListUser %v", err) |
| 19 | return |
| 20 | } |
| 21 | userName = resp.Users.User[0].UserName |
| 22 | profileRequest := ProfileRequest{ |
| 23 | UserName: userName, |
| 24 | Password: password, |
| 25 | } |
| 26 | response, err := client.CreateLoginProfile(profileRequest) |
| 27 | if err != nil { |
| 28 | t.Errorf("Failed to CreateLoginProfile %v", err) |
| 29 | } |
| 30 | t.Logf("pass CreateLoginProfile %v", response) |
| 31 | } |
| 32 | |
| 33 | func TestGetLoginProfile(t *testing.T) { |
| 34 | client := NewTestClient() |
| 35 | resp, err := client.GetLoginProfile(UserQueryRequest{UserName: userName}) |
| 36 | if err != nil { |
| 37 | t.Errorf("Failed to GetLoginProfile %v", err) |
| 38 | } |
| 39 | t.Logf("pass GetLoginProfile %v", resp) |
| 40 | } |
| 41 | |
| 42 | func TestUpdateLoginProfile(t *testing.T) { |
| 43 | client := NewTestClient() |
| 44 | profileRequest := ProfileRequest{ |
| 45 | UserName: userName, |
| 46 | Password: passwordNew, |
| 47 | } |
| 48 | resp, err := client.UpdateLoginProfile(profileRequest) |
| 49 | if err != nil { |
| 50 | t.Errorf("Failed to UpdateLoginProfile %v", err) |
| 51 | } |
| 52 | t.Logf("pass UpdateLoginProfile %v", resp) |
| 53 | } |
| 54 | |
| 55 | func TestDeleteLoginProfile(t *testing.T) { |
| 56 | client := NewTestClient() |
| 57 | resp, err := client.DeleteLoginProfile(UserQueryRequest{UserName: userName}) |
| 58 | if err != nil { |
| 59 | t.Errorf("Failed to DeleteLoginProfile %v", err) |
| 60 | } |
| 61 | t.Logf("pass DeleteLoginProfile %v", resp) |
| 62 | } |