예제 #1
0
파일: test_api.py 프로젝트: tjdett/mytardis
 def setUp(self):
     super(MyTardisResourceTestCase, self).setUp()
     self.username = '******'
     self.password = '******'
     self.user = User.objects.create_user(username=self.username,
                                          password=self.password)
     test_auth_service = AuthService()
     test_auth_service._set_user_from_dict(self.user,
                                           user_dict={
                                               'first_name': 'Testing',
                                               'last_name': 'MyTardis API',
                                               'email':
                                               '*****@*****.**'
                                           },
                                           auth_method="None")
     self.user.user_permissions.add(
         Permission.objects.get(codename='change_dataset'))
     self.user.user_permissions.add(
         Permission.objects.get(codename='add_dataset_file'))
     self.user_profile = UserProfile(user=self.user).save()
     self.testexp = Experiment(title="test exp")
     self.testexp.approved = True
     self.testexp.created_by = self.user
     self.testexp.locked = False
     self.testexp.save()
     testacl = ObjectACL(content_type=self.testexp.get_ct(),
                         object_id=self.testexp.id,
                         pluginId=django_user,
                         entityId=str(self.user.id),
                         canRead=True,
                         canWrite=True,
                         canDelete=True,
                         isOwner=True,
                         aclOwnershipType=ObjectACL.OWNER_OWNED)
     testacl.save()
예제 #2
0
 def setUp(self):
     super(MyTardisResourceTestCase, self).setUp()
     self.username = '******'
     self.password = '******'
     self.user = User.objects.create_user(username=self.username,
                                          password=self.password)
     test_auth_service = AuthService()
     test_auth_service._set_user_from_dict(
         self.user,
         user_dict={'first_name': 'Testing',
                    'last_name': 'MyTardis API',
                    'email': '*****@*****.**'},
         auth_method="None")
     self.user.user_permissions.add(
         Permission.objects.get(codename='change_dataset'))
     self.user.user_permissions.add(
         Permission.objects.get(codename='add_dataset_file'))
     self.user_profile = UserProfile(user=self.user).save()
     self.testexp = Experiment(title="test exp")
     self.testexp.approved = True
     self.testexp.created_by = self.user
     self.testexp.locked = False
     self.testexp.save()
     testacl = ObjectACL(
         content_type=self.testexp.get_ct(),
         object_id=self.testexp.id,
         pluginId=django_user,
         entityId=str(self.user.id),
         canRead=True,
         canWrite=True,
         canDelete=True,
         isOwner=True,
         aclOwnershipType=ObjectACL.OWNER_OWNED)
     testacl.save()
 def setUp(self):
     super(MyTardisResourceTestCase, self).setUp()
     self.username = '******'
     self.password = '******'
     self.user = User.objects.create_user(username=self.username,
                                          password=self.password)
     test_auth_service = AuthService()
     test_auth_service._set_user_from_dict(
         self.user,
         user_dict={'first_name': 'Testing',
                    'last_name': 'MyTardis API',
                    'email': '*****@*****.**'},
         auth_method="None")
     self.testgroup = Group(name="Test Group")
     self.testgroup.save()
     self.testgroup.user_set.add(self.user)
     self.testfacility = Facility(name="Test Facility",
                                  manager_group=self.testgroup)
     self.testfacility.save()
     self.testinstrument = Instrument(name="Test Instrument",
                                      facility=self.testfacility)
     self.testinstrument.save()
예제 #4
0
 def setUp(self):
     super(MyTardisResourceTestCase, self).setUp()
     self.username = '******'
     self.password = '******'
     self.user = User.objects.create_user(username=self.username,
                                          password=self.password)
     test_auth_service = AuthService()
     test_auth_service._set_user_from_dict(
         self.user,
         user_dict={'first_name': 'Testing',
                    'last_name': 'MyTardis API',
                    'email': '*****@*****.**'},
         auth_method="None")
     self.user_profile = UserProfile(user=self.user).save()
     self.testgroup = Group(name="Test Group")
     self.testgroup.save()
     self.testgroup.user_set.add(self.user)
     self.testfacility = Facility(name="Test Facility",
                                  manager_group=self.testgroup)
     self.testfacility.save()
     self.testinstrument = Instrument(name="Test Instrument",
                                      facility=self.testfacility)
     self.testinstrument.save()