'PUT new content group.'

def test_can_create_new_content_group_if_it_does_not_exist(self):

    expected = {u'id': 666, u'name': u'Test    name', u'scheme': u'cohort', u'description': u'Test    description', u'version': UserPartition.VERSION, u'groups': [{u'id': 0, u'name': u'Group    A', u'version': 1, u'usage': []}, {u'id': 1, u'name': u'Group    B', u'version': 1, u'usage': []}], u'parameters': {}, u'active': True}
    response = self.client.put(self._url(cid=666), data=json.dumps(expected), content_type='application/json', HTTP_ACCEPT='application/json', HTTP_X_REQUESTED_WITH='XMLHttpRequest')
    content = json.loads(response.content)
    self.assertEqual(content, expected)
    self.reload_course()
    user_partitions = self.course.user_partitions
    self.assertEqual(len(user_partitions), 1)
    self.assertEqual(user_partitions[0].name, u'Test    name')
    self.assertEqual(len(user_partitions[0].groups), 2)
    self.assertEqual(user_partitions[0].groups[0].name, u'Group    A')
    self.assertEqual(user_partitions[0].groups[1].name, u'Group    B')
    self.assertEqual(user_partitions[0].parameters, {})
