---
"Help":
  - do:
      cat.repositories:
        help: true

  - match:
      $body: |
               /^  id   .+ \n
                   type .+ \n
               $/
---
"Test cat repositories output":

  - do:
      cat.repositories: {}

  - match:
      $body: |
               /^$/

  - do:
      snapshot.create_repository:
        repository: test_cat_repo_1
        body:
          type: fs
          settings:
            location: "test_cat_repo_1_loc"

  - do:
      snapshot.create_repository:
        repository: test_cat_repo_2
        body:
          type: fs
          settings:
            location: "test_cat_repo_2_loc"

  - do:
      cat.repositories: {}

  - match:
      $body: |
               /^   test_cat_repo_1\s+ fs\s*\n
                    test_cat_repo_2\s+ fs\s*\n
               $/

---
"Test cat repositories sort":
  - skip:
      version: " - 5.0.99"
      reason:  sorting was introduced in 5.1.0
  - do:
      snapshot.create_repository:
        repository: test_cat_repo_1
        body:
          type: fs
          settings:
            location: "test_cat_repo_1_loc"

  - do:
      snapshot.create_repository:
        repository: test_cat_repo_2
        body:
          type: fs
          settings:
            location: "test_cat_repo_2_loc"

  - do:
      cat.repositories:
        s: [type, id]

  - match:
      $body: |
             /^ test_cat_repo_1 \s+ fs \n
                test_cat_repo_2 \s+ fs \n
             $/

  - do:
      cat.repositories:
        s: [type, "id:desc"]

  - match:
      $body: |
             /^ test_cat_repo_2 \s+ fs \n
                test_cat_repo_1 \s+ fs \n
             $/
