github.com/vmware/govmomi@v0.37.2/govc/test/sso.bats (about)

     1  #!/usr/bin/env bats
     2  
     3  load test_helper
     4  
     5  @test "sso.service.ls" {
     6    vcsim_env
     7  
     8    sts=$(govc option.ls config.vpxd.sso.sts.uri | awk '{print $2}')
     9  
    10    # Remove credentials from URL, lookup service allows anonymous access
    11    GOVC_URL="$(govc env GOVC_URL)"
    12  
    13    run govc sso.service.ls
    14    assert_success
    15  
    16    run govc sso.service.ls -l
    17    assert_success
    18  
    19    run govc sso.service.ls -json
    20    assert_success
    21  
    22    run govc sso.service.ls -dump
    23    assert_success
    24  
    25    [ -z "$(govc sso.service.ls -t enoent)" ]
    26  
    27    run govc sso.service.ls -t cs.identity -P wsTrust -U
    28    assert_success "$sts"
    29  
    30    run govc sso.service.ls -t sso:sts -U
    31    assert_success "$sts"
    32  
    33    cert=$(govc about.cert -show | grep -v CERTIFICATE | tr -d '\n')
    34    trust=$(govc sso.service.ls -json -t sso:sts | jq -r .[].ServiceEndpoints[].SslTrust[0])
    35    assert_equal "$cert" "$trust"
    36  
    37    govc sso.service.ls -t cs.identity | grep com.vmware.cis | grep -v https:
    38    govc sso.service.ls -t cs.identity -l | grep https:
    39    govc sso.service.ls -p com.vmware.cis -t cs.identity -P wsTrust -T com.vmware.cis.cs.identity.sso -l | grep wsTrust
    40    govc sso.service.ls -P vmomi | grep vcenterserver | grep -v https:
    41    govc sso.service.ls -P vmomi -l | grep https:
    42  }
    43  
    44  @test "sso.idp.ls" {
    45    vcsim_env
    46  
    47    run govc sso.idp.ls -json
    48    assert_success
    49  
    50    run govc sso.idp.ls
    51    assert_success
    52    [ ${#lines[@]} -eq 4 ]
    53    assert_matches "System Domain"
    54    assert_matches "Local OS"
    55    assert_matches "ActiveDirectory"
    56  }
    57  
    58  @test "sso.user" {
    59    vcsim_env
    60  
    61    run govc sso.user.ls
    62    assert_success
    63  
    64    run govc sso.user.create -p password govc
    65    assert_success
    66  
    67    run govc sso.user.ls
    68    assert_success
    69    assert_matches govc
    70  
    71    run govc sso.user.ls -s
    72    assert_success ""
    73  
    74    run govc sso.user.create -p password govc
    75    assert_failure # duplicate name
    76  
    77    run govc sso.user.update -p newpassword govc
    78    assert_success
    79  
    80    run govc sso.user.rm govc
    81    assert_success
    82  
    83    run govc sso.user.rm govc
    84    assert_failure # does not exist
    85  
    86    run govc sso.user.create -C dummy-cert govc
    87    assert_success
    88  
    89    run govc sso.user.update -C new-cert govc
    90    assert_success
    91  
    92    run govc sso.user.ls -s
    93    assert_success
    94    assert_matches govc
    95  }
    96  
    97  @test "sso.group" {
    98    vcsim_env
    99  
   100    run govc sso.group.ls
   101    assert_success
   102  
   103    run govc sso.group.create bats
   104    assert_success
   105  
   106    run govc sso.group.create -d "govc CLI" govc
   107    assert_success
   108  
   109    run govc sso.group.ls
   110    assert_success
   111    assert_matches "govc CLI"
   112  
   113    run govc sso.group.update -d "govmomi/govc CLI" govc
   114    assert_success
   115    run govc sso.group.ls
   116    assert_success
   117    assert_matches "govmomi/govc CLI"
   118  
   119    run govc sso.group.update -a user govc
   120    assert_success
   121  
   122    govc sso.user.id | grep "groups=govc"
   123  
   124    run govc sso.group.update -r user govc
   125    assert_success
   126    govc sso.user.id | grep -v "groups=govc"
   127  
   128    run govc sso.group.update -g -a govc bats
   129    assert_success
   130  
   131    run govc sso.group.ls govc
   132    assert_success
   133    assert_matches bats
   134  
   135    run govc sso.group.rm govc
   136    assert_success
   137  
   138    run govc sso.group.rm govc
   139    assert_failure # does not exist
   140  }