This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"schemas": { | |
"LaneProvisioningTokenDto": { | |
"type": "object", | |
"properties": { | |
"token": { | |
"type": "string" | |
}, | |
"lane": { | |
"allOf": [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
image: docker:latest | |
services: | |
- docker:dind | |
variables: | |
CONTAINER_TEST_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG | |
CONTAINER_RELEASE_IMAGE: $CI_REGISTRY_IMAGE:latest | |
before_script: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This script tests the retrieval of a JWT access token and submission of the token to the Discovery Service. If all goes | |
well, you should see a print out of the token and data from the Discovery API's courses endpoint. | |
NOTE: You will need to install the edx-rest-api-client package at https://pypi.python.org/pypi/edx-rest-api-client. | |
""" | |
from edx_rest_api_client.client import EdxRestApiClient | |
# TODO Set these values to the URLs of your own services | |
ACCESS_TOKEN_URL = 'https://courses.example.com/oauth2/access_token' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def counter(fn): | |
""" | |
Adds a call counter to the given function. | |
Source: http://code.activestate.com/recipes/577534-counting-decorator/ | |
""" | |
def _counted(*largs, **kargs): | |
_counted.invocations += 1 | |
fn(*largs, **kargs) | |
_counted.invocations = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
import pytz | |
from oscar.core.loading import get_model | |
from ecommerce.courses.models import Course | |
from ecommerce.invoice.models import Invoice | |
Order = get_model('order', 'Order') | |
OrderLine = get_model('order', 'Line') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
git checkout master | |
git pull | |
services=(credentials discovery ecommerce) | |
for service in "${services[@]}" | |
do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Is the openedx directory useful, or causing pain? The `skip_unless_lms` test decorator seems like an anti-pattern. If an | |
# app is specific to one project, its code should probably live in that project. This script is meant to help determine how | |
# many, and which, apps should be moved out of openedx. | |
import pprint | |
import os | |
DJANGO_APP_DIRS = ( | |
'cms/djangoapps', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Create profiles for service users. """ | |
from django.contrib.auth import get_user_model | |
from student.models import UserProfile | |
User = get_user_model() | |
usernames = ('affiliate_window', 'course_discovery_worker', 'programs_worker', 'sailthru',) | |
for username in usernames: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from edx_rest_api_client.client import EdxRestApiClient | |
ACCESS_TOKEN = '' | |
basket_ids = [] | |
api_client = EdxRestApiClient('https://ecommerce.stage.edx.org/api/v2/', oauth_access_token=ACCESS_TOKEN) | |
for basket_id in basket_ids: | |
if not api_client.baskets(basket_id).delete(): | |
print('Failed to delete basket [{}].'.format(basket_id)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Number of students who have submitted credit requests, | |
-- grouped by course and status. | |
SELECT | |
co.course_key | |
, cr.status | |
, COUNT(1) AS 'count' | |
FROM | |
credit_creditrequest cr | |
JOIN credit_creditcourse co ON cr.course_id = co.id | |
GROUP BY |
NewerOlder