Skip to content

Commit

Permalink
Merge pull request #265 from edx/zafzal/ENT-8136
Browse files Browse the repository at this point in the history
feat: Added revoke and bulkLicenseEnrollment endpoint
  • Loading branch information
zamanafzal committed Jan 10, 2024
2 parents 155b10d + 0f249ff commit d94f876
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 1 deletion.
4 changes: 4 additions & 0 deletions swagger/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ paths:
# These are served from the license manager IDA, but we surface them with the rest of the enterprise endpoints
"/enterprise/v1/subscriptions/{uuid}/licenses/assign":
$ref: "https://raw.githubusercontent.com/edx/license-manager/eb9407e/api.yaml#/endpoints/v1/assignLicenses"
"/enterprise/v1/subscriptions/{uuid}/licenses/bulk-revoke":
$ref: "https://raw.githubusercontent.com/edx/license-manager/1f3037b/api.yaml#/endpoints/v1/revokeLicenses"
"/enterprise/v1/bulk-license-enrollment":
$ref: "https://raw.githubusercontent.com/edx/license-manager/1f3037b/api.yaml#/endpoints/v1/bulkLicenseEnrollment"
# Enterprise Catalog IDA
# These are served from the enterprise catalog IDA, but we surface them with the rest of the enterprise endpoints
"/enterprise/v2/enterprise-catalogs":
Expand Down
72 changes: 71 additions & 1 deletion tests/test_enterprise.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@
- expected_status: [200]

- test:
- name: 'License assign endpoint rejected without authorization HTTP 200'
- name: 'License assign endpoint rejected without authorization HTTP 400'
- url: '/enterprise/v1/subscriptions/9101d3de36156cba/licenses/assign'
- method: 'POST'
- headers: {'Content-Type': 'application/json'}
Expand All @@ -279,3 +279,73 @@
}
]
- expected_status: [400]

- test:
- name: 'License revokes endpoint returns HTTP 200'
- url: '/enterprise/v1/subscriptions/9101d3de36156cba/licenses/bulk-revoke/'
- method: 'POST'
- headers: {'Authorization': 'aeiou', 'Content-Type': 'application/json'}
- body: >
[
{
"user_emails": ["edx@example.com", "abc@example.com"] }
]
- expected_status: [200]

- test:
- name: 'License revokes endpoint rejected without authorization HTTP 400'
- url: '/enterprise/v1/subscriptions/9101d3de36156cba/licenses/bulk-revoke/'
- method: 'POST'
- headers: {'Content-Type': 'application/json'}
- body: >
[
{
"filters": [{"status_in": ['activated', 'assigned']}]
}
]
- expected_status: [400]

- test:
- name: 'Bulk learner enrollment in given list of courses endpoint returns HTTP 200'
- url: '/enterprise/v1/bulk-license-enrollment?enterprise_customer_uuid=234555'
- method: 'POST'
- headers: {'Authorization': 'aeiou', 'Content-Type': 'application/json'}
- body: >
[
{
"emails": ["edx@example.com"],
"course_run_keys": ["testX"],
"notify": true
}
]
- expected_status: [200]

- test:
- name: 'Bulk learner enrollment in given list of courses endpoint returns HTTP 400 without enterprise_customer_uuid'
- url: '/enterprise/v1/bulk-license-enrollment'
- method: 'POST'
- headers: {'Authorization': 'aeiou', 'Content-Type': 'application/json'}
- body: >
[
{
"emails": ["edx@example.com"],
"course_run_keys": ["testX"],
"notify": true
}
]
- expected_status: [400]

- test:
- name: 'Bulk learner enrollment in given list of courses endpoint rejected without authorization HTTP 400'
- url: '/enterprise/v1/bulk-license-enrollment'
- method: 'POST'
- headers: {'Content-Type': 'application/json'}
- body: >
[
{
"emails": ["edx@example.com"],
"course_run_keys": ["testX"],
"notify": true
}
]
- expected_status: [400]

0 comments on commit d94f876

Please sign in to comment.