Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
f3465287
Commit
f3465287
authored
Jun 13, 2014
by
Zia Fazal
Committed by
Jonathan Piacenti
Aug 20, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
link orgs to groups
Generated migration
parent
5200eea5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
1 deletions
+24
-1
lms/djangoapps/api_manager/migrations/0011_auto__add_coursemodulecompletion.py
+0
-0
lms/djangoapps/api_manager/models.py
+1
-0
lms/djangoapps/api_manager/organizations/serializers.py
+1
-1
lms/djangoapps/api_manager/organizations/tests.py
+22
-0
No files found.
lms/djangoapps/api_manager/migrations/0011_auto__add_coursemodulecompletion.py
0 → 100644
View file @
f3465287
This diff is collapsed.
Click to expand it.
lms/djangoapps/api_manager/models.py
View file @
f3465287
...
...
@@ -142,6 +142,7 @@ class Organization(TimeStampedModel):
contact_phone
=
models
.
CharField
(
max_length
=
50
,
null
=
True
,
blank
=
True
)
workgroups
=
models
.
ManyToManyField
(
Workgroup
,
related_name
=
"organizations"
)
users
=
models
.
ManyToManyField
(
User
,
related_name
=
"organizations"
)
groups
=
models
.
ManyToManyField
(
Group
,
related_name
=
"organizations"
)
class
CourseModuleCompletion
(
TimeStampedModel
):
...
...
lms/djangoapps/api_manager/organizations/serializers.py
View file @
f3465287
...
...
@@ -13,5 +13,5 @@ class OrganizationSerializer(serializers.ModelSerializer):
""" Serializer/field specification """
model
=
Organization
fields
=
(
'url'
,
'id'
,
'name'
,
'display_name'
,
'contact_name'
,
'contact_email'
,
'contact_phone'
,
'workgroups'
,
'users'
,
'created'
,
'modified'
)
'users'
,
'
groups'
,
'
created'
,
'modified'
)
read_only
=
(
'url'
,
'id'
,
'created'
)
lms/djangoapps/api_manager/organizations/tests.py
View file @
f3465287
...
...
@@ -33,6 +33,7 @@ class OrganizationsApiTests(TestCase):
self
.
test_server_prefix
=
'https://testserver'
self
.
test_organizations_uri
=
'/api/organizations/'
self
.
test_users_uri
=
'/api/users'
self
.
base_groups_uri
=
'/api/groups'
self
.
test_organization_name
=
str
(
uuid
.
uuid4
())
self
.
test_organization_display_name
=
'Test Org'
self
.
test_organization_contact_name
=
'John Org'
...
...
@@ -167,3 +168,24 @@ class OrganizationsApiTests(TestCase):
}
response
=
self
.
do_post
(
self
.
test_organizations_uri
,
data
)
self
.
assertEqual
(
response
.
status_code
,
400
)
def
test_organizations_list_post_with_groups
(
self
):
groups
=
[]
for
i
in
xrange
(
1
,
6
):
data
=
{
'name'
:
'{} {}'
.
format
(
'Test Group'
,
i
),
'type'
:
'series'
,
'data'
:
{
'display_name'
:
'My first series'
}
}
response
=
self
.
do_post
(
self
.
base_groups_uri
,
data
)
self
.
assertEqual
(
response
.
status_code
,
201
)
groups
.
append
(
response
.
data
[
'id'
])
data
=
{
'name'
:
self
.
test_organization_name
,
'display_name'
:
self
.
test_organization_display_name
,
'groups'
:
groups
}
response
=
self
.
do_post
(
self
.
test_organizations_uri
,
data
)
self
.
assertEqual
(
response
.
status_code
,
201
)
self
.
assertEqual
(
len
(
response
.
data
[
'groups'
]),
len
(
groups
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment