Skip to content

Commit

Permalink
Merge pull request #3202 from learningequality/hotfixes
Browse files Browse the repository at this point in the history
Patch 2 for release 2021-05-24
  • Loading branch information
bjester authored Jun 15, 2021
2 parents f65e57f + 8d3a466 commit 62baa46
Show file tree
Hide file tree
Showing 7 changed files with 146 additions and 14 deletions.
28 changes: 27 additions & 1 deletion contentcuration/contentcuration/tests/test_chef_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def test_authenticate_user_internal(self):
response = self.post(self.authenticate_user_internal_url, None)
assert response.status_code == 200
data = json.loads(response.content)
assert data["success"] == True
assert data["success"]
assert data["username"] == user().email

def test_check_version_bad_request(self):
Expand Down Expand Up @@ -184,6 +184,32 @@ def test_add_nodes(self):
response.content
)

def test_add_node_with_tags(self):
response = self.post(
self.create_channel_url, {"channel_data": channel_metadata}
)
assert response.status_code == 200
data = json.loads(response.content)
assert "root" in data

node_data = node_json(
{"kind": "video", "license": cc.License.objects.all()[0].license_name}
)
unique_title = "This is a title that we can almost certainly find uniquely later"
node_data["tags"] = ["test"]
node_data["title"] = unique_title
response = self.post(
self.add_nodes_url, {"root_id": data["root"], "content_data": [node_data]}
)
assert response.status_code == 200, "Call failed:\n output: {}".format(
response.content
)

node = cc.ContentNode.objects.get(title=unique_title)

self.assertEqual(node.tags.count(), 1)
self.assertEqual(node.tags.first().tag_name, "test")

def test_finish_channel_bad_request(self):
response = self.post(self.finish_channel_url, {})
assert response.status_code == 400
Expand Down
7 changes: 3 additions & 4 deletions contentcuration/contentcuration/views/internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def api_commit_channel(request):
event = generate_update_event(
channel_id,
CHANNEL,
{"root_id": obj.main_tree.id, "staging_root_id": obj.staging_tree.id,},
{"root_id": obj.main_tree.id, "staging_root_id": obj.staging_tree.id},
)

# Mark old staging tree for garbage collection
Expand Down Expand Up @@ -441,7 +441,7 @@ def get_channel_status_bulk(request):
raise PermissionDenied()
statuses = {cid: get_status(cid) for cid in data['channel_ids']}

return Response({"success": True, "statuses": statuses,})
return Response({"success": True, "statuses": statuses})
except (Channel.DoesNotExist, PermissionDenied):
return HttpResponseNotFound(
"No complete set of channels matching: {}".format(",".join(channel_ids))
Expand Down Expand Up @@ -642,8 +642,7 @@ def create_node(node_data, parent_node, sort_order): # noqa: C901
)

if len(tags) > 0:
node.tags = tags
node.save()
node.tags.set(tags)

return node

Expand Down
39 changes: 39 additions & 0 deletions integration_testing/features/create-a-collection.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Feature: Create a collection

Background:
Given I am signed in to Studio
And I am on the *Collections* tab

Scenario: Create an empty collection
When I click the *New collection* button
And I fill in the *Collection name* field
And I click the *Create* button
Then I see the *Collections* tab
And I see the newly created collection

Scenario: Create a collection by selecting channels
When I click the *New collection* button
And I click the *Select channels* button
Then I see the *Select channels* page
And I am on the *Content library* tab # alternatively I can select the *My channels* or *View-only* tab
When I select one or several channels
And I click the *Finish* button
Then I see the the *New collection* screen with the selected channels
When I click the *Create* button
Then I see the *Collections* tab
And I see the newly created collection
And I see the number of channels in that collection

Scenario: Create a collection by searching for channels
When I click the *New collection* button
And I click the *Select channels* button
Then I see the *Select channels* page
And I am on the *Content library* tab # alternatively I can select the *My channels* or *View-only* tab
When I enter a search term in the *Search for a channel* field
And I select one or several channels
And I click the *Finish* button
Then I see the the *New collection* screen with the selected channels
When I click the *Create* button
Then I see the *Collections* tab
And I see the newly created collection
And I see the number of channels in that collection
20 changes: 11 additions & 9 deletions integration_testing/features/create-a-topic.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ Feature: Create a topic

Background:
Given I am signed in to Studio
And I am on the directory selection screen
And I find a destination I want to move content into
And I am on the channel editor page

Scenario: Create a topic
When I click *New topic* button in the top right corner
Then a modal appears prompting a new topic title
When I name give the topic a title
And I click *Create*
Then the new topic appears in that node directory
And a snackbar appears confirming the new topic creation
Scenario: Create a topic
When I click the *Add* button in the top right corner
And I click the *New topic* option
Then I see the *New topic* modal
When I fill in the required field *Title*
And I fill in any of the other fields such as *Description*, *Tags* and *Language*
And I add a thumbnail image
And I click the *Finish* button
Then I am on the channel editor page
And I can see the newly created topic
14 changes: 14 additions & 0 deletions integration_testing/features/delete-a-collection.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Feature: Delete a collection

Background:
Given I am signed in to Studio
And I am on the *Collections* tab
And there is at least one collection

Scenario: Delete a collection
When I click the *Options* drop-down for the collection I want to edit
And I select the *Delete collection* option
Then I see the *Delete collection* modal window
When I click the *Delete collection* button
Then I see the *Collections* tab
And I see that the deleted collection is no longer displayed
23 changes: 23 additions & 0 deletions integration_testing/features/edit-a-collection.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Feature: Edit a collection

Background:
Given I am signed in to Studio
And I am on the *Collections* tab
And there is at least one collection

Scenario: Edit a collection
When I click the *Options* drop-down for the collection I want to edit
And I select the *Edit collection* option
Then I see the collection's details
And I can change the collection name
When I click the *Select channels* button
Then I am on the *Content library* tab # alternatively I can select the *My channels* or *View-only* tab
When I select one or several channels
And I click the *Finish* button
Then I see the the *New collection* screen with the selected channels
When I click the *Remove* button
Then I see a message *Channel removed*
When I click the *Save and close* button
Then I see the *Collections* tab
And I see the edited collection
And I see the number of channels in that collection
29 changes: 29 additions & 0 deletions integration_testing/features/set-up-empty-topic-tree.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Feature: Set up empty topic tree

Background:
Given I am signed in to Studio
And I am on the channel editor page for an empty channel

Scenario: Create an empty topic tree
When I click the *Add* button in the top right corner
And I click the *New topic* option
Then I see the *New topic* modal
When I fill in the required fields
And I click the *Add new topic* button
Then I can fill in the required fields for a new topic #repeat this process for as many empty topics you need
When I click the *Finish* button
Then I am on the channel editor page
And I can see the empty topics

Scenario: Create sub-topics
Given I have created an empty topic tree
When I click *⋮* (Options) button for a topic
And I click the *New topic* option
Then I see the *New topic* modal
When I fill in the required fields
And I click the *Add new topic* button
Then I can fill in the required fields for a new topic #repeat this process for as many empty topics you need
When I click the *Finish* button
Then I am on the channel editor page
And I can click on the topic to see the created sub-topics

0 comments on commit 62baa46

Please sign in to comment.