«

PATCH /api/M26/clans/{clanCode} - Cập nhật thông tin phường

  • Chỉ chủ phường mới có thể cập nhật thông tin phường
  • Request body: { "name": "Tên mới của phường", "description": "Mô tả Phườngmới", "avatar": "https://example.com/avatar.png", "wallpaper": "https://example.com/avatar.png", "requestRequired": true }
  • Tags: @AUTOMATED, @TNK-9582

    Trả về lỗi 401 khi gửi request cập nhật phường mà không có token

    • Given Tài khoản "ownerclan" đã tạo phường với thông tin
      codenamedescription
      clan_01AutoTestCall API
    • And Request có header là
      X-Tenantm26
    • When Gửi request "PATCH" đến "/M26/clans/${clan_01}" với body
      {
        "name": "Tên phường mới"
      }
    • Then Tôi nhận được response có HTTP Status 401
  • Tags: @AUTOMATED, @TNK-9582

    Trả về lỗi 401 khi gửi request cập nhật phường với token không hợp lệ

    • Given Tài khoản "ownerclan" đã tạo phường với thông tin
      codenamedescription
      clan_01AutoTestCall API
    • And Request có header là
      X-Tenantm26
    • And Token đã hết hạn
    • When Gửi request "PATCH" đến "/M26/clans/${clan_01}" với body
      {
        "name": "Tên phường mới"
      }
    • Then Tôi nhận được response có HTTP Status 401
  • Tags: @AUTOMATED, @TNK-9582

    Trả về lỗi 400 khi gửi request cập nhật phường mà không gửi kèm header X-Tenant

    • Given Tài khoản "ownerclan" đã tạo phường với thông tin
      codenamedescription
      clan_01AutoTestCall API
    • And Có token của tài khoản "ownerclan"
    • When Gửi request "PATCH" đến "/M26/clans/${clan_01}" với body
      {
        "name": "Tên phường mới"
      }
    • Then Tôi nhận được response có HTTP Status 400
    • And Response có body thỏa mãn giá trị như sau
      {
        "title": "Bad Request",
        "detail": "Required header 'X-Tenant' is not present."
      }
  • Tags: @AUTOMATED, @TNK-9582

    Trả về lỗi 404 khi gửi request cập nhật phường với header không hợp lệ

    • Given Tài khoản "ownerclan" đã tạo phường với thông tin
      codenamedescription
      clan_01AutoTestCall API
    • And Request có header là
      X-Tenant<tenant>
    • And Có token của tài khoản "ownerclan"
    • When Gửi request "PATCH" đến "/M26/clans/${clan_01}" với body
      {
        "name": "Tên phường mới"
      }
    • Then Tôi nhận được response có HTTP Status 404
    • And Response có body thỏa mãn giá trị như sau
      {
        "title": "clan_not_found"
      }
  • Tags: @AUTOMATED, @TNK-11536, @TNK-9582

    Trả về 200 khi gửi request cập nhật phường với thông tin hợp lệ. Hệ thống ghi lại log khi cập nhật phường

    • Given Chủ phường "ownerclan" chọn ảnh "imageClan" làm ảnh phường
    • And Chủ phường "ownerclan" chọn ảnh "imageClan2" làm ảnh phường
    • And Tài khoản "ownerclan" đã tạo phường với thông tin
      codenamedescriptionavatarwallpaperrequestRequired
      clan_01AutoTest<description><image><image><requestRequired>
    • And Request có header là
      X-Tenantm26
    • And Có token của tài khoản "ownerclan"
    • When Gửi request "PATCH" đến "/M26/clans/${clan_01}" với body
      {
        "name": "Tên phường mới",
        "description": <descriptionUpdate>,
        "avatar": <imageUpdate>,
        "wallpaper": <imageUpdate>,
        "requestRequired": <requestRequiredUpdate>
      }
    • Then Tôi nhận được response có HTTP Status 200
    • And Response có body thỏa mãn giá trị như sau
      {
        "code": "${clan_01}",
        "name": "Tên phường mới",
        "description": <descriptionUpdate>,
        "avatar": <imageUpdate>,
        "wallpaper": <imageUpdate>,
        "owner": "ownerclan",
        "requestRequired": <requestRequiredUpdate>
      }
    • When Gửi request "GET" đến "/M26/clans/${clan_01}/logs"
    • Then Response có body thỏa mãn giá trị như sau
      [
      {
      "activity": "CLAN_UPDATE",
      "actor": {
        "username": "ownerclan"
      },
      "change": {
        "type": "PROPERTY_CHANGE",
        "newObject": [
          {
            "avatar": <imageUpdate>,
            "code": "${clan_01}",
            "description": <descriptionUpdate>,
            "name": "Tên phường mới",
            "owner": "ownerclan",
            "requestRequired": <requestRequiredUpdate>,
            "wallpaper": <imageUpdate>
          }
        ]
      }
      }
      ]

    Examples:

    description image requestRequired descriptionUpdate imageUpdate requestRequiredUpdate
    Hôm nay trời đẹp imageClan true "Hôm nay trời đẹp, mình đổi mô tả" "${imageClan2}" false
    Hôm nay trời đẹp imageClan false null null true
    true "Hôm nay trời đẹp, mình đổi mô tả" "${imageClan2}" false
  • Tags: @AUTOMATED, @TNK-13354, @TNK-9582

    Trả về lỗi 400 khi gửi request cập nhật tên phường null

    • Given Tài khoản "ownerclan" đã tạo phường với thông tin
      codenamedescription
      clan_01AutoTestCall API
    • And Request có header là
      X-Tenantm26
    • And Có token của tài khoản "ownerclan"
    • When Gửi request "PATCH" đến "/M26/clans/${clan_01}" với body
      {
        "name": null
      }
    • Then Tôi nhận được response có HTTP Status 400
  • Tags: @AUTOMATED, @TNK-11536, @TNK-9582

    Trả về lỗi 400 khi gửi request cập nhật phường với trường requestRequired có định dạng không hợp lệ

    • Given Tài khoản "ownerclan" đã tạo phường với thông tin
      codenamedescription
      clan_01AutoTestCall API
    • And Request có header là
      X-Tenantm26
    • And Có token của tài khoản "ownerclan"
    • When Gửi request "PATCH" đến "/M26/clans/${clan_01}" với body
      {
        "requestRequired": "test"
      }
    • Then Tôi nhận được response có HTTP Status 400
    • And Response có body thỏa mãn giá trị như sau
      {
        "title": "Bad Request",
        "detail": "Failed to read HTTP message"
      }
  • Tags: @AUTOMATED, @TNK-9582

    Trả về lỗi 403 khi gửi request cập nhật phường với token của tài khoản không phải là chủ phường

    • Given Tài khoản "ownerclan" đã tạo phường với thông tin
      codenamedescription
      clan_01AutoTestCall API
    • And Request có header là
      X-Tenantm26
    • And Có token của tài khoản "pamela"
    • When Gửi request "PATCH" đến "/M26/clans/${clan_01}" với body
      {
        "name": "Tên phường mới"
      }
    • Then Tôi nhận được response có HTTP Status 403
    • And Response có body thỏa mãn giá trị như sau
      {
        "title": "action_not_allow",
        "detail": "only owner can update clan"
      }
  • Tags: @AUTOMATED, @TNK-9582

    Trả về lỗi 404 khi gửi request cập nhật phường không tồn tại

    • Given Request có header là
      X-Tenantm26
    • And Có token của tài khoản "ownerclan"
    • When Gửi request "PATCH" đến "/M26/clans/notExist" với body
      {
        "name": "Tên phường mới"
      }
    • Then Tôi nhận được response có HTTP Status 404
    • And Response có body thỏa mãn giá trị như sau
      {
        "title": "clan_not_found"
      }
  • Tags: @AUTOMATED, @TNK-11563

    Nếu có user đã đăng ký vào phường và cần duyệt, khi thay đổi quyền tham gia phường thành không cần duyệt,

    yêu cầu tham gia phường vẫn giữ nguyên

    • Given Tài khoản "ownerclan" đã tạo phường với thông tin
      codenamedescriptionrequestRequired
      clan_01AutoTestCall APItrue
    • And Khách hàng "userclan" "đã gửi" yêu cầu tham gia phường
      clanCode
      clan_01
    • And Request có header là
      X-Tenantm26
    • And Có token của tài khoản "ownerclan"
    • When Gửi request "PATCH" đến "/M26/clans/${clan_01}" với body
      {
        "requestRequired": false
      }
    • Then Tôi nhận được response có HTTP Status 200
    • When Gửi request "GET" đến "/M26/clans/${clan_01}/requests"
    • Then Tôi nhận được response có HTTP Status 200
    • And Response có body thỏa mãn giá trị như sau
      [
        {
          "clan": {
          "code": "${clan_01}",
          "name": "AutoTest"
        },
        "requestUser": "userclan"
        }
      ]