<s> from __future__ import unicode_literals <EOL> from rest_framework import status <EOL> from rest_framework import test <EOL> from nodeconductor . iaas . tests import factories <EOL> from nodeconductor . structure . tests import factories as structure_factories <EOL> class ProjectAddendumApiPermissionTest ( test . APITransactionTestCase ) : <EOL> def test_user_can_not_delete_project_with_connected_instances ( self ) : <EOL> user = structure_factories . UserFactory ( is_staff = True ) <EOL> self . client . force_authenticate ( user = user ) <EOL> instance = factories . InstanceFactory ( ) <EOL> project = instance . cloud_project_membership . project <EOL> response = self . client . delete ( structure_factories . ProjectFactory . get_url ( project ) ) <EOL> self . assertEqual ( response . status_code , status . HTTP_409_CONFLICT ) <EOL> self . assertDictContainsSubset ( { '<STR_LIT>' : '<STR_LIT>' } , <EOL> response . data ) </s>
