

def test_bulk_creates_children_and_sanitizes_html_logged_in_owner(self):
    title = '<em>Cool</em> <strong>Project</strong>'
    description = 'An <script>alert("even cooler")</script> child'
    res = self.app.post_json_api(self.url, {
        'data': [{
            'type': 'nodes',
            'attributes': {
                'title': title,
                'description': description,
                'category': 'project',
                'public': True,
            },
        }],
    }, auth=self.user.auth, bulk=True)
    child_id = res.json['data'][0]['id']
    assert_equal(res.status_code, 201)
    url = '/{}nodes/{}/'.format(API_BASE, child_id)
    res = self.app.get(url, auth=self.user.auth)
    assert_equal(res.json['data']['attributes']['title'], strip_html(title))
    assert_equal(res.json['data']['attributes']['description'], strip_html(description))
    assert_equal(res.json['data']['attributes']['category'], 'project')
    self.project.reload()
    child_id = res.json['data']['id']
    assert_equal(child_id, self.project.nodes[0]._id)
    assert_equal(Node.load(child_id).logs[0].action, NodeLog.PROJECT_CREATED)

dataset/ETHPy150Open CenterForOpenScience/osf.io/api_tests/nodes/views/test_node_children_list.py TestNodeChildrenBulkCreate.test_bulk_creates_children_and_sanitizes_html_logged_in_owner/original