def test_userkey_generation(self): osfuser_id = Guid.objects.get(_id=self.user._id).object_id userkey_generation(self.user._id) rdmuserkey_pvt_key = RdmUserKey.objects.filter( guid=osfuser_id, key_kind=api_settings.PRIVATE_KEY_VALUE) nt.assert_equal(rdmuserkey_pvt_key.count(), 1) rdmuserkey_pub_key = RdmUserKey.objects.filter( guid=osfuser_id, key_kind=api_settings.PUBLIC_KEY_VALUE) nt.assert_equal(rdmuserkey_pub_key.count(), 1)
def setUp(self): super(TestTimeStampTokenVerifyCheck, self).setUp() self.project = ProjectFactory() self.node = self.project self.user = self.project.creator self.auth_obj = Auth(user=self.project.creator) userkey_generation(self.user._id) # Refresh records from database; necessary for comparing dates self.project.reload() self.user.reload()
def setUp(self): super(TestAddTimestamp, self).setUp() self.project = ProjectFactory() self.node = self.project self.user = self.project.creator self.node_settings = self.project.get_addon('osfstorage') self.auth_obj = Auth(user=self.project.creator) userkey_generation(self.user._id) # Refresh records from database; necessary for comparing dates self.project.reload() self.user.reload()
def setUp(self): super(TestTimestampVerifyData, self).setUp() self.user = AuthUserFactory() ## create project(affiliated institution) self.project_institution = InstitutionFactory() self.project_user = UserFactory() userkey_generation(self.project_user._id) self.project_user.affiliated_institutions.add(self.project_institution) self.user = self.project_user self.private_project1 = ProjectFactory(creator=self.project_user) self.private_project1.affiliated_institutions.add( self.project_institution) self.node = self.private_project1 self.request_url = '/timestampadd/' + str( self.project_institution.id) + '/nodes/' + str( self.private_project1.id) + '/verify/verify_data/'
def setUp(self): super(TestTimeStampAddList, self).setUp() self.user = AuthUserFactory() ## create project(affiliated institution) self.project_institution = InstitutionFactory() self.project_user = UserFactory() userkey_generation(self.project_user._id) self.project_user.affiliated_institutions.add(self.project_institution) self.user = self.project_user self.private_project1 = ProjectFactory(creator=self.project_user) self.private_project1.affiliated_institutions.add( self.project_institution) self.node = self.private_project1 self.request = RequestFactory().get('/timestampadd/' + str(self.project_institution.id) + '/nodes/' + str(self.private_project1.id) + '/') self.view = views.TimeStampAddList() self.view = setup_user_view(self.view, self.request, user=self.user) self.view.kwargs = {'institution_id': self.project_institution.id} create_rdmfiletimestamptokenverifyresult( self, filename='osfstorage_test_file1.status_1', provider='osfstorage', inspection_result_status_1=True) create_rdmfiletimestamptokenverifyresult( self, filename='osfstorage_test_file2.status_3', provider='osfstorage', inspection_result_status_1=False) create_rdmfiletimestamptokenverifyresult( self, filename='osfstorage_test_file3.status_3', provider='osfstorage', inspection_result_status_1=False) create_rdmfiletimestamptokenverifyresult( self, filename='s3_test_file1.status_3', provider='s3', inspection_result_status_1=False)
def setUp(self): super(TestInstitutionNodeList, self).setUp() self.user = AuthUserFactory() ## create project(affiliated institution) self.project_institution = InstitutionFactory() self.project_user = UserFactory() userkey_generation(self.project_user._id) self.project_user.affiliated_institutions.add(self.project_institution) self.private_project1 = ProjectFactory(creator=self.project_user) self.private_project1.affiliated_institutions.add( self.project_institution) self.private_project2 = ProjectFactory(creator=self.project_user) self.private_project2.affiliated_institutions.add( self.project_institution) self.request = RequestFactory().get('/timestampadd/' + str(self.project_institution.id) + '/nodes/') self.view = views.InstitutionNodeList() self.view = setup_user_view(self.view, self.request, user=self.user) self.view.kwargs = {'institution_id': self.project_institution.id}
def test_userkey_generation_check_return_true(self): userkey_generation(self.user._id) nt.assert_true(userkey_generation_check(self.user._id))