def _project_create(self, project_data={}, merge=True):
        view = ProjectViewSet.as_view({
            'post': 'create'
        })

        if merge:
            data = {
                'name': u'demo',
                'owner':
                'http://testserver/api/v1/users/%s' % self.user.username,
                'metadata': {'description': 'Some description',
                             'location': 'Naivasha, Kenya',
                             'category': 'governance'},
                'public': False
            }
            data.update(project_data)
        else:
            data = project_data

        request = self.factory.post(
            '/', data=json.dumps(data),
            content_type="application/json", **self.extra)
        response = view(request, owner=self.user.username)
        self.assertEqual(response.status_code, 201)
        self.project = Project.objects.filter(
            name=data['name'], created_by=self.user)[0]
        data['url'] = 'http://testserver/api/v1/projects/%s'\
            % self.project.pk
        self.assertDictContainsSubset(data, response.data)

        request.user = self.user
        self.project_data = ProjectSerializer(
            self.project, context={'request': request}).data
dataset/ETHPy150Open kobotoolbox/kobocat/onadata/apps/api/tests/viewsets/test_abstract_viewset.py/TestAbstractViewSet._project_create/original