How to use isprivate method in Contexts

Best Python code snippet using Contexts

forms.py

Source:forms.py Github

copy

Full Screen

1#gameheart.entities.forms2from django import forms3from django.contrib.admin import widgets4from django.contrib.admin.widgets import FilteredSelectMultiple5from django.contrib.auth.models import User6from django.contrib.auth.forms import UserCreationForm7from gameheart.entities.models import *8from gameheart.entities.helpers import *9class GHForm(forms.ModelForm):10 class Meta:11 abstract = True12 def __init__(self, user=None, *args, **kwargs):13 super(GHForm, self).__init__(*args, **kwargs)14 userinfo = getuserinfo(user)15 if not userinfo:16 admin = True17 else:18 admin = userinfo['isadmin']19 instance = kwargs.pop('instance',None)20 owned = isowned(instance,user)21 approver = isapprover(instance,user)22 if hasattr(self,'readonlyfields'):23 for field in self.readonlyfields:24 self.fields[field].widget.attrs['readonly'] = True25 self.fields[field].widget.attrs['disabled'] = True26 self.fields[field].required = False27 if hasattr(self,'adminonlyfields') and admin == False:28 for field in self.adminonlyfields:29 self.fields[field].widget = forms.HiddenInput()30 self.fields[field].widget.attrs['disabled'] = True31 if hasattr(self,'isprivate'):32 if self.isprivate == True and owned == False and admin == False and instance:33 for field in self.Meta.fields:34 self.fields[field].widget.attrs['readonly'] = True35 self.fields[field].widget.attrs['disabled'] = True36 if hasattr(self,'ownedonlyfields') and owned == False:37 for field in self.ownedonlyfields:38 self.fields[field].widget = forms.HiddenInput()39 self.fields[field].widget.attrs['disabled'] = True40 if hasattr(self,'approveronlyfields') and approver == False:41 for field in self.approveronlyfields:42 self.fields[field].widget = forms.HiddenInput()43 self.fields[field].widget.attrs['disabled'] = True44 if hasattr(self,'hiddenfields'):45 for field in self.hiddenfields:46 self.fields[field].widget = forms.HiddenInput()47 self.fields[field].widget.attrs['disabled'] = True48class UserForm(UserCreationForm):49 class Meta:50 model = User51 fields = ['username','email',]52 widgets = {53 'password':forms.PasswordInput54 }55 isadmin = False56 isprivate = True57 mname = 'User'58class UserAccountForm(forms.ModelForm):59 class Meta:60 model = User61 fields = ['username','first_name','last_name','email']62 buttons = [63 {'name':'xpspend','class':'button','id':'xpspend','value':'Spend XP','link':'spendxp/','isadmin':False,'isnew':False}]64 isadmin = False65 isprivate = False66 mname = 'User'67class UserProfileForm(forms.ModelForm):68 class Meta:69 model = UserProfile70 fields = ['name','description']71 isadmin = False72 isprivate = False73 mname = 'User'74class UserDetailProfileForm(GHForm):75 class Meta:76 model = UserProfile77 fields = ['name','isadmin','description']78 adminonlyfields = ['isadmin']79 isadmin = False80 isprivate = False81 mname = 'User'82class UserLoginForm(forms.ModelForm):83 class Meta:84 model = User85 fields = ['username', 'password']86 widgets = {87 'password':forms.PasswordInput88 }89 isadmin = False90 isprivate = False91 mname = 'User'92class ChapterTypeForm(GHForm):93 class Meta:94 model = ChapterType95 fields = ['name', 'description','dateactive','dateexpiry']96 adminonlyfields = ['dateactive','dateexpiry']97 ifields = ['name']98 sname = Vocabulary.objects.get(name='ChapterType').displayname99 surl = '/types/chapters/'100 sheading = ''.join(['Add New ',sname])101 isadmin = True102 isprivate = False103 mname = 'ChapterType'104class StaffTypeForm(GHForm):105 class Meta:106 model = StaffType107 fields = ['name', 'isapprover', 'isdirector', 'description','dateactive','dateexpiry']108 adminonlyfields = ['dateactive','dateexpiry','isapprover', 'isdirector']109 ifields = ['name']110 sname = Vocabulary.objects.get(name='StaffType').displayname111 surl = '/types/staff/'112 sheading = ''.join(['Add New ',sname])113 isadmin = True114 isprivate = False115 mname = 'StaffType'116class StaffForm(GHForm):117 class Meta:118 model = Staff119 fields = ['user', 'type','dateactive','dateexpiry']120 adminonlyfields = ['dateactive','dateexpiry']121 lfield = 'chapter'122 sname = Vocabulary.objects.get(name='Staff').displayname123 surl = '/staff/'124 sheading = ''.join(['Add New ',sname])125 isadmin = False126 isprivate = False127 mname = 'Staff'128 def __init__(self, *args, **kwargs):129 super(StaffForm,self).__init__(*args, **kwargs)130 self.fields['user'].label = Vocabulary.objects.get(name='User').displayname131class ChapterForm(GHForm):132 class Meta:133 model = Chapter134 fields = ['name', 'type', 'description', 'dateactive', 'dateexpiry']135 exclude = []136 adminonlyfields = ['dateactive','dateexpiry']137 ifields = ['name', 'type']138 buttons = []139 lform = StaffForm140 sname = Vocabulary.objects.get(name='Chapter').displayname141 surl = '/chapters/'142 sheading = ''.join(['Add New ',sname])143 isadmin = True144 isprivate = True145 mname = 'Chapter'146class ChapterAddressForm(GHForm):147 class Meta:148 model = ChapterAddress149 fields = ['name', 'chapter', 'address1', 'address2', 'city', 'state', 'zip', 'dateactive','dateexpiry']150 adminonlyfields = ['dateactive','dateexpiry']151 ifields = ['name', 'chapter', 'city', 'state']152 sname = ''.join([Vocabulary.objects.get(name='ChapterAddress').displayname])153 surl = '/chapters/addresses/'154 sheading = ''.join(['Add New ',sname])155 isadmin = False156 isprivate = False157 mname = 'ChapterAddress'158 def __init__(self, *args, **kwargs):159 super(ChapterAddressForm,self).__init__(*args, **kwargs)160 self.fields['chapter'].label = Vocabulary.objects.get(name='Chapter').displayname161class CharacterTypeForm(GHForm):162 class Meta:163 model = CharacterType164 fields = ['name', 'description','dateactive','dateexpiry']165 adminonlyfields = ['dateactive','dateexpiry']166 ifields = ['name']167 sname = Vocabulary.objects.get(name='CharacterType').displayname168 surl = '/types/characters/'169 sheading = ''.join(['Add New ',sname])170 isadmin = True171 isprivate = False172 mname = 'CharacterType'173class CharacterOwnerForm(GHForm):174 class Meta:175 model = CharacterOwner176 fields = ['user','iscontroller','dateactive','dateexpiry']177 adminonlyfields = ['iscontroller','dateactive','dateexpiry']178 lfield = 'character'179 sname = 'Character Owner'180 surl = '/characters/owners/'181 sheading = 'Assign Character to User'182 isadmin = False183 isprivate = False184 mname = 'CharacterOwner'185class CharacterForm(GHForm):186 class Meta:187 model = Character188 fields = ['name', 'type', 'chapter', 'public_description', 'private_description','dateactive','dateexpiry']189 exclude = []190 adminonlyfields = ['dateactive','dateexpiry']191 ownedonlyfields = ['type','private_description']192 ifields = ['name', 'type', 'chapter']193 directorfields = ['name', 'type', 'chapter', 'isprimary', 'isnew', 'public_description', 'private_description']194 lform = CharacterOwnerForm195 sname = Vocabulary.objects.get(name='Character').displayname196 surl = '/characters/'197 sheading = ''.join(['Add New ',sname])198 buttons = [199 {'name':'sheet','class':'button','id':'sheet','value':'View Sheet','link':'grid/','isadmin':False,'isnew':False,'check':False,'newtab':False,'controlleronly':False,'directoronly':False},200 {'name':'print','class':'button','id':'print','value':'Print','link':'print/','isadmin':False,'isnew':False,'check':False,'newtab':True,'controlleronly':False,'directoronly':False},201 {'name':'xplog','class':'button','id':'xplog','value':'XP Log','link':'calcxp/','isadmin':False,'isnew':False,'check':False,'newtab':False,'controlleronly':False,'directoronly':False},202 #{'name':'fix','class':'button','id':'fix','value':'Fix','link':'fix/','isadmin':False,'isnew':False,'check':False,'newtab':False,'controlleronly':False,'directoronly':True},203 {'name':'labels','class':'button','id':'labels','value':'Labels','link':'traits/labels/','isadmin':False,'isnew':False,'check':False,'newtab':False,'controlleronly':False,'directoronly':True},204 {'name':'remove','class':'button','id':'remove','value':'Remove','link':'hide/','isadmin':False,'isnew':True,'check':True,'newtab':False,'controlleronly':True,'directoronly':True}205 ]206 isadmin = False207 isprivate = True208 mname = 'Character'209 def __init__(self, *args, **kwargs):210 super(CharacterForm,self).__init__(*args, **kwargs)211 self.fields['chapter'].label = Vocabulary.objects.get(name='Chapter').displayname212class TraitTypeForm(GHForm):213 charactertypes = forms.ModelMultipleChoiceField(queryset=CharacterType.objects.activeonly(),widget=forms.CheckboxSelectMultiple(),required=False)214 chaptertypes = forms.ModelMultipleChoiceField(queryset=ChapterType.objects.activeonly(),widget=forms.CheckboxSelectMultiple(),required=False)215 class Meta:216 model = TraitType217 fields = ['name', 'aggregate', 'onepercharacter', 'multiplyxp', 'labelable', 'xpcost1','xpcost2','xpcost3','xpcost4','xpcost5','cotrait','availtocontroller','availtoapprover','availtodirector','description', 'charactertypes', 'chaptertypes', 'dateactive','dateexpiry']218 adminonlyfields = ['dateactive','dateexpiry']219 ifields = ['name']220 sname = Vocabulary.objects.get(name='TraitType').displayname221 surl = '/types/traits/'222 sheading = ''.join(['Add New ',sname])223 isadmin = True224 isprivate = False225 mname = 'TraitType'226 def __init__(self, *args, **kwargs):227 super(TraitTypeForm,self).__init__(*args, **kwargs)228 self.fields['labelable'].label = 'Can be Labeled'229class TraitForm(GHForm):230 charactertypes = forms.ModelMultipleChoiceField(queryset=CharacterType.objects.activeonly(),widget=forms.CheckboxSelectMultiple(),required=False)231 chaptertypes = forms.ModelMultipleChoiceField(queryset=ChapterType.objects.activeonly(),widget=forms.CheckboxSelectMultiple(),required=False)232 cotraits = forms.ModelMultipleChoiceField(queryset=Trait.objects.cotraits(),widget=widgets.FilteredSelectMultiple(verbose_name='Required Traits',is_stacked=False),required=False)233 bantraits = forms.ModelMultipleChoiceField(queryset=Trait.objects.cotraits(),widget=widgets.FilteredSelectMultiple(verbose_name='Banned Traits',is_stacked=False),required=False)234 addtraits = forms.ModelMultipleChoiceField(queryset=Trait.objects.cotraits(),widget=widgets.FilteredSelectMultiple(verbose_name='Add Traits',is_stacked=False),required=False)235 class Meta:236 model = Trait237 fields = ['name', 'type', 'level', 'isadmin', 'renamable', 'description', 'charactertypes', 'chaptertypes', 'cotraits','bantraits','addtraits','dateactive','dateexpiry']238 adminonlyfields = ['isadmin', 'dateactive','dateexpiry']239 ifields = ['type', 'name']240 fieldlist = ['id', 'name', 'level', 'xpcost', 'bpcost', 'description']241 sname = Vocabulary.objects.get(name='Trait').displayname242 surl = '/traits/'243 sheading = ''.join(['Add New ',sname])244 isadmin = True245 isprivate = False246 mname = 'Trait'247 def __init__(self, *args, **kwargs):248 super(TraitForm,self).__init__(*args, **kwargs)249 self.fields['renamable'].label = 'Can be Ranamed'250 Trait.__unicode__ = Trait.cotrait_label251class CharacterTraitForm(GHForm):252 class Meta:253 model = CharacterTrait254 fields = ['character', 'trait', 'iscreation', 'isfree', 'authorizedby', 'dateauthorized', 'dateremoved', 'dateactive','dateexpiry']255 adminonlyfields = ['authorizedby','dateauthorized','dateactive','dateexpiry']256 approveronlyfields = ['iscreation','isfree','authorizedby','dateauthorized','dateremoved','dateactive','dateexpiry']257 readonlyfields = ['character','trait']258 sname = 'Character Trait'259 surl = '/characters/traits/'260 sheading = 'Add New Trait to Character'261 sredirect = 'user_index'262 isadmin = False263 isprivate = False264 mname = 'CharacterTrait'265class AttendanceForm(GHForm):266 class Meta:267 model = Attendance268 fields = ['user','character','event','xpawarded','authorizedby']269 adminonlyfields = ['user','event','authorizedby']270 hiddenfields = ['user','event','authorizedby']271 fieldlabels = [Vocabulary.objects.get(name='User').displayname,Vocabulary.objects.get(name='Character').displayname,Vocabulary.objects.get(name='Event').displayname,'xpawarded','authorizedby']272 lfield = 'event'273 sname = 'Attendance'274 surl = '/chapterss/events/attendance/'275 sheading = ''.join(['Sign in to ',Vocabulary.objects.get(name='Event').displayname])276 isadmin = False277 isprivate = False278 mname = 'Attendance'279 def __init__(self, *args, **kwargs):280 super(AttendanceForm,self).__init__(*args, **kwargs)281 self.fields['user'].label = Vocabulary.objects.get(name='User').displayname282 self.fields['event'].label = Vocabulary.objects.get(name='Event').displayname283class AttendanceGameForm(GHForm):284 class Meta:285 model = Attendance286 fields = ['user','character','event','xpawarded','authorizedby']287 adminonlyfields = ['user','event','authorizedby']288 hiddenfields = ['user','event','authorizedby']289 fieldlabels = [Vocabulary.objects.get(name='User').displayname,Vocabulary.objects.get(name='Character').displayname,Vocabulary.objects.get(name='Event').displayname,'xpawarded','authorizedby']290 lfield = 'event'291 sname = 'Attendance'292 surl = '//'293 sheading = ''.join(['Sign in to ',Vocabulary.objects.get(name='Event').displayname])294 isadmin = False295 isprivate = False296 mname = 'Attendance'297 def __init__(self, *args, **kwargs):298 super(AttendanceGameForm,self).__init__(*args, **kwargs)299 self.fields['user'].label = Vocabulary.objects.get(name='User').displayname300 self.fields['event'].label = Vocabulary.objects.get(name='Event').displayname301class EventForm(GHForm):302 class Meta:303 model = Event304 fields = ['name', 'chapter', 'chapteraddress', 'dateheld','dateactive','dateexpiry']305 adminonlyfields = ['dateactive','dateexpiry']306 ifields = ['name', 'chapter']307 #approveronlyfields = ['name', 'chapter', 'chapteraddress', 'dateheld']308 lform = AttendanceForm309 sname = Vocabulary.objects.get(name='Event').displayname310 surl = '/chapters/events/'311 sheading = ''.join(['Add New ',sname])312 isadmin = False313 isprivate = False314 mname = 'Event'315 buttons = []316 def __init__(self, *args, **kwargs):317 super(EventForm,self).__init__(*args, **kwargs)318 self.fields['chapter'].label = Vocabulary.objects.get(name='Chapter').displayname319 self.fields['chapteraddress'].label = Vocabulary.objects.get(name='ChapterAddress').displayname320class NoteForm(GHForm):321 class Meta:322 model = Note323 fields = ['subject', 'body','character','chapter','trait','traitlevel','stafftype','dateactive','dateexpiry']324 adminonlyfields = ['dateactive','dateexpiry']325 sname = Vocabulary.objects.get(name='Note').displayname326 surl = '/notes/'327 sheading = ''.join(['Add New ',sname])328 isadmin = False329 isprivate = False330 mname = 'Note'331class NoteTagForm(GHForm):332 class Meta:333 model = NoteTag334 fields = ['tag','dateactive','dateexpiry']335 adminonlyfields = ['dateactive','dateexpiry']336 sname = 'Note'337 surl = '/notes/tags/'338 sheading = 'Add New Note Tag'339 isadmin = False340 isprivate = False341 mname = 'NoteTag'342class FavoriteUserForm(GHForm):343 class Meta:344 model = FavoriteUser345 fields = ['favoriteuser']346 adminonlyfields = []347 fkmodel = UserProfile348 fkfield = 'favoriteuser'349 sname = ''.join([Vocabulary.objects.get(name='Favorite').displayname, ' ', Vocabulary.objects.get(name='User').displayname])350 surl = '/account/favorites/users/'351 sheading = ''.join([Vocabulary.objects.get(name='Favorite').displayname, ' ', Vocabulary.objects.get(name='User').displayplural])352 isadmin = False353 isprivate = False354 lform = UserForm355 mname = 'FavoriteUser'356 def __init__(self, *args, **kwargs):357 super(FavoriteUserForm,self).__init__(*args, **kwargs)358 self.fields['favoriteuser'].label = ''.join([Vocabulary.objects.get(name='Favorite').displayname,' ',Vocabulary.objects.get(name='User').displayname])359class FavoriteChapterForm(GHForm):360 class Meta:361 model = FavoriteChapter362 fields = ['favoritechapter']363 adminonlyfields = []364 fkmodel = Chapter365 fkfield = 'favoritechapter'366 sname = ''.join([Vocabulary.objects.get(name='Favorite').displayname, ' ', Vocabulary.objects.get(name='Chapter').displayname])367 surl = '/account/favorites/chapters/'368 sheading = ''.join([Vocabulary.objects.get(name='Favorite').displayname, ' ', Vocabulary.objects.get(name='Chapter').displayplural])369 isadmin = False370 isprivate = False371 lform = ChapterForm372 mname = 'FavoriteChapter'373 def __init__(self, *args, **kwargs):374 super(FavoriteChapterForm,self).__init__(*args, **kwargs)375 self.fields['favoritechapter'].label = ''.join([Vocabulary.objects.get(name='Favorite').displayname,' ',Vocabulary.objects.get(name='Chapter').displayname])376class FavoriteCharacterForm(GHForm):377 class Meta:378 model = FavoriteCharacter379 fields = ['favoritecharacter']380 adminonlyfields = []381 fkmodel = Character382 fkfield = 'favoritecharacter'383 sname = ''.join([Vocabulary.objects.get(name='Favorite').displayname, ' ', Vocabulary.objects.get(name='Character').displayname])384 surl = '/account/favorites/characters/'385 sheading = ''.join([Vocabulary.objects.get(name='Favorite').displayname, ' ', Vocabulary.objects.get(name='Character').displayplural])386 isadmin = False387 isprivate = False388 lform = CharacterForm389 mname = 'FavoriteCharacter'390 def __init__(self, *args, **kwargs):391 super(FavoriteCharacterForm,self).__init__(*args, **kwargs)392 self.fields['favoritecharacter'].label = ''.join([Vocabulary.objects.get(name='Favorite').displayname,' ',Vocabulary.objects.get(name='Character').displayname])393class VocabularyForm(GHForm):394 class Meta:395 model = Vocabulary396 fields = ['displayname','displayplural']397 adminonlyfields = ['displayname', 'displayplural']398 sname = 'Vocabulary'399 surl = '/vocabulary/'400 sheading = 'Vocabulary'401 isadmin = False402 isprivate = False403 mname = 'Vocabulary'404class TransactionForm(GHForm):405 class Meta:406 model = Transaction407 fields = ['user','txnid','amount','dateactive','dateexpiry']408 adminonlyfields = ['dateactive','dateexpiry']409 isadmin = False410 isprivate = False411 mname = 'Transaction'412class SubscriptionForm(GHForm):413 class Meta:414 model = Subscription415 fields = ['user','name','pp_period3','pp_auth','pp_charset','pp_receiver_email','pp_amount3','pp_form_charset','pp_item_number','pp_payer_email','pp_recurring','pp_last_name','pp_payer_id','pp_mc_amount3','pp_subscr_id','pp_mc_currency','pp_txn_id','pp_txn_type','pp_btn_id','pp_item_name','pp_payer_status','pp_password','pp_reattempt','pp_residence_country','pp_business','pp_subscr_date','pp_first_name','notes','dateactive','dateexpiry']416 adminonlyfields = ['dateactive','dateexpiry']417 surl = '/subscriptions/'418 isadmin = False419 isprivate = False...

Full Screen

Full Screen

test_managers.py

Source:test_managers.py Github

copy

Full Screen

1"""Tests for managers of categories."""2from django.test import TestCase3from django.core.exceptions import PermissionDenied4from nose.tools import raises5from geokey.projects.tests.model_factories import UserFactory, ProjectFactory6from geokey.projects.models import Project7from ..models import Field, Category, LookupValue, MultipleLookupValue8from .model_factories import (9 TextFieldFactory,10 CategoryFactory,11 LookupValueFactory,12 MultipleLookupValueFactory13)14class CategoryManagerTest(TestCase):15 def test_access_with_projct_admin(self):16 admin = UserFactory.create()17 project = ProjectFactory.create(18 add_admins=[admin],19 **{'isprivate': True}20 )21 CategoryFactory(**{22 'project': project,23 'status': 'active'24 })25 CategoryFactory(**{26 'project': project,27 'status': 'inactive'28 })29 self.assertEqual(30 len(Category.objects.get_list(admin, project.id)), 231 )32 def test_access_with_projct_contributor(self):33 contributor = UserFactory.create()34 project = ProjectFactory.create(35 add_contributors=[contributor],36 **{'isprivate': True}37 )38 active = CategoryFactory(**{39 'project': project,40 'status': 'active'41 })42 CategoryFactory(**{43 'project': project,44 'status': 'inactive'45 })46 types = Category.objects.get_list(contributor, project.id)47 self.assertEqual(len(types), 1)48 self.assertIn(active, types)49 @raises(Project.DoesNotExist)50 def test_access_with_projct_non_member(self):51 contributor = UserFactory.create()52 project = ProjectFactory.create()53 CategoryFactory(**{54 'project': project,55 'status': 'active'56 })57 CategoryFactory(**{58 'project': project,59 'status': 'inactive'60 })61 Category.objects.get_list(contributor, project.id)62 def test_access_active_with_admin(self):63 admin = UserFactory.create()64 project = ProjectFactory.create(65 add_admins=[admin],66 **{'isprivate': True}67 )68 active_type = CategoryFactory(**{69 'project': project,70 'status': 'active'71 })72 self.assertEqual(active_type, Category.objects.get_single(73 admin, project.id, active_type.id))74 def test_access_inactive_with_admin(self):75 admin = UserFactory.create()76 project = ProjectFactory.create(77 add_admins=[admin],78 **{'isprivate': True}79 )80 inactive_type = CategoryFactory(**{81 'project': project,82 'status': 'inactive'83 })84 self.assertEqual(inactive_type, Category.objects.get_single(85 admin, project.id, inactive_type.id))86 def test_access_active_with_contributor(self):87 contributor = UserFactory.create()88 project = ProjectFactory.create(89 add_contributors=[contributor],90 **{'isprivate': True}91 )92 active_type = CategoryFactory(**{93 'project': project,94 'status': 'active'95 })96 self.assertEqual(active_type, Category.objects.get_single(97 contributor, project.id, active_type.id))98 @raises(PermissionDenied)99 def test_access_inactive_with_contributor(self):100 contributor = UserFactory.create()101 project = ProjectFactory.create(102 add_contributors=[contributor],103 **{'isprivate': True}104 )105 inactive_type = CategoryFactory(**{106 'project': project,107 'status': 'inactive'108 })109 Category.objects.get_single(110 contributor, project.id, inactive_type.id)111 @raises(Project.DoesNotExist)112 def test_access_active_with_non_member(self):113 contributor = UserFactory.create()114 project = ProjectFactory.create(**{115 'isprivate': True,116 })117 active_type = CategoryFactory(**{118 'project': project,119 'status': 'active'120 })121 self.assertEqual(active_type, Category.objects.get_single(122 contributor, project.id, active_type.id))123 @raises(Project.DoesNotExist)124 def test_access_inactive_with_non_member(self):125 contributor = UserFactory.create()126 project = ProjectFactory.create(**{127 'isprivate': True,128 })129 inactive_type = CategoryFactory(**{130 'project': project,131 'status': 'inactive'132 })133 Category.objects.get_single(134 contributor, project.id, inactive_type.id)135 def test_admin_access_with_admin(self):136 admin = UserFactory.create()137 project = ProjectFactory.create(138 add_admins=[admin],139 **{'isprivate': True}140 )141 active_type = CategoryFactory(**{142 'project': project143 })144 self.assertEqual(active_type, Category.objects.as_admin(145 admin, project.id, active_type.id))146 @raises(PermissionDenied)147 def test_admin_access_with_contributor(self):148 user = UserFactory.create()149 project = ProjectFactory.create(150 add_contributors=[user],151 **{'isprivate': True}152 )153 active_type = CategoryFactory(**{154 'project': project155 })156 Category.objects.as_admin(user, project.id, active_type.id)157 @raises(Project.DoesNotExist)158 def test_admin_access_with_non_member(self):159 user = UserFactory.create()160 project = ProjectFactory.create(**{161 'isprivate': True162 })163 active_type = CategoryFactory(**{164 'project': project165 })166 Category.objects.as_admin(user, project.id, active_type.id)167class FieldManagerTest(TestCase):168 def test_access_fields_with_admin(self):169 admin = UserFactory.create()170 project = ProjectFactory.create(171 add_admins=[admin],172 **{'isprivate': True}173 )174 category = CategoryFactory(**{175 'project': project,176 'status': 'active'177 })178 TextFieldFactory.create(**{179 'status': 'active',180 'category': category181 })182 TextFieldFactory.create(**{183 'status': 'inactive',184 'category': category185 })186 self.assertEqual(187 len(Field.objects.get_list(admin, project.id, category.id)),188 2189 )190 def test_access_active_field_with_admin(self):191 user = UserFactory.create()192 project = ProjectFactory.create(193 add_admins=[user],194 **{'isprivate': True}195 )196 category = CategoryFactory(**{197 'project': project,198 'status': 'active'199 })200 field = TextFieldFactory.create(**{201 'status': 'active',202 'category': category203 })204 self.assertEqual(205 field, Field.objects.get_single(206 user, project.id, category.id, field.id))207 def test_access_inactive_field_with_admin(self):208 user = UserFactory.create()209 project = ProjectFactory.create(210 add_admins=[user],211 **{'isprivate': True}212 )213 category = CategoryFactory(**{214 'project': project,215 'status': 'active'216 })217 field = TextFieldFactory.create(**{218 'status': 'inactive',219 'category': category220 })221 self.assertEqual(222 field, Field.objects.get_single(223 user, project.id, category.id, field.id))224 def test_admin_access_active_field_with_admin(self):225 user = UserFactory.create()226 project = ProjectFactory.create(227 add_admins=[user],228 **{'isprivate': True}229 )230 category = CategoryFactory(**{231 'project': project,232 'status': 'active'233 })234 field = TextFieldFactory.create(**{235 'status': 'active',236 'category': category237 })238 self.assertEqual(239 field, Field.objects.as_admin(240 user, project.id, category.id, field.id))241 def test_access_fields_with_contributor(self):242 user = UserFactory.create()243 project = ProjectFactory.create(244 add_contributors=[user],245 **{'isprivate': True}246 )247 category = CategoryFactory(**{248 'project': project,249 'status': 'active'250 })251 TextFieldFactory.create(**{252 'status': 'active',253 'category': category254 })255 inactive = TextFieldFactory.create(**{256 'status': 'inactive',257 'category': category258 })259 fields = Field.objects.get_list(user, project.id, category.id)260 self.assertEqual(len(fields), 1)261 self.assertNotIn(inactive, fields)262 def test_access_active_field_with_contributor(self):263 user = UserFactory.create()264 project = ProjectFactory.create(265 add_contributors=[user],266 **{'isprivate': True}267 )268 category = CategoryFactory(**{269 'project': project,270 'status': 'active'271 })272 field = TextFieldFactory.create(**{273 'status': 'active',274 'category': category275 })276 self.assertEqual(277 field, Field.objects.get_single(278 user, project.id, category.id, field.id))279 @raises(PermissionDenied)280 def test_access_active_field_inactive_cat_with_contributor(self):281 user = UserFactory.create()282 project = ProjectFactory.create(283 add_contributors=[user],284 **{'isprivate': True}285 )286 category = CategoryFactory(**{287 'project': project,288 'status': 'inactive'289 })290 field = TextFieldFactory.create(**{291 'status': 'active',292 'category': category293 })294 Field.objects.get_single(user, project.id, category.id, field.id)295 @raises(PermissionDenied)296 def test_access_inactive_field_with_contributor(self):297 user = UserFactory.create()298 project = ProjectFactory.create(299 add_contributors=[user],300 **{'isprivate': True}301 )302 category = CategoryFactory(**{303 'project': project,304 'status': 'active'305 })306 field = TextFieldFactory.create(**{307 'status': 'inactive',308 'category': category309 })310 Field.objects.get_single(311 user, project.id, category.id, field.id)312 @raises(PermissionDenied)313 def test_admin_access_active_field_with_contributor(self):314 user = UserFactory.create()315 project = ProjectFactory.create(316 add_contributors=[user],317 **{'isprivate': True}318 )319 category = CategoryFactory(**{320 'project': project,321 'status': 'active'322 })323 field = TextFieldFactory.create(**{324 'status': 'active',325 'category': category326 })327 Field.objects.as_admin(328 user, project.id, category.id, field.id)329 @raises(Project.DoesNotExist)330 def test_access_fields_with_non_member(self):331 user = UserFactory.create()332 project = ProjectFactory.create(**{'isprivate': True})333 category = CategoryFactory(**{334 'project': project,335 'status': 'active'336 })337 TextFieldFactory.create(**{338 'status': 'active',339 'category': category340 })341 TextFieldFactory.create(**{342 'status': 'inactive',343 'category': category344 })345 Field.objects.get_list(user, project.id, category.id)346 @raises(Project.DoesNotExist)347 def test_access_active_field_with_non_member(self):348 user = UserFactory.create()349 project = ProjectFactory.create(**{'isprivate': True})350 category = CategoryFactory(**{351 'project': project,352 'status': 'active'353 })354 field = TextFieldFactory.create(**{355 'status': 'active',356 'category': category357 })358 Field.objects.get_single(359 user, project.id, category.id, field.id)360 @raises(Project.DoesNotExist)361 def test_access_inactive_field_with_non_member(self):362 user = UserFactory.create()363 project = ProjectFactory.create(**{'isprivate': True})364 category = CategoryFactory(**{365 'project': project,366 'status': 'active'367 })368 field = TextFieldFactory.create(**{369 'status': 'inactive',370 'category': category371 })372 Field.objects.get_single(373 user, project.id, category.id, field.id)374 @raises(Project.DoesNotExist)375 def test_admin_access_active_field_with_non_member(self):376 user = UserFactory.create()377 project = ProjectFactory.create(**{'isprivate': True})378 category = CategoryFactory(**{379 'project': project,380 'status': 'active'381 })382 field = TextFieldFactory.create(**{383 'status': 'active',384 'category': category385 })386 Field.objects.as_admin(387 user, project.id, category.id, field.id)388class LookupManagerTest(TestCase):389 def tearDown(self):390 for lookup_value in LookupValue.objects.all():391 if lookup_value.symbol is not None:392 lookup_value.symbol.delete()393 for lookup_value in MultipleLookupValue.objects.all():394 if lookup_value.symbol is not None:395 lookup_value.symbol.delete()396 def test_with_lookup_value(self):397 LookupValueFactory.create_batch(5, **{'status': 'active'})398 LookupValueFactory.create_batch(5, **{'status': 'deleted'})399 values = LookupValue.objects.active()400 self.assertEqual(len(values), 5)401 def test_with_multiple_lookup_value(self):402 MultipleLookupValueFactory.create_batch(5, **{'status': 'active'})403 MultipleLookupValueFactory.create_batch(5, **{'status': 'deleted'})404 values = MultipleLookupValue.objects.active()...

Full Screen

Full Screen

test_videos_db_functions.py

Source:test_videos_db_functions.py Github

copy

Full Screen

1from unittest.mock import patch2from pymongo_inmemory import MongoClient3from app_server.videos_db_functions import *4from app_server.users_db_functions import insert_new_user5from app_server.users import respond_to_friendship_request6from app_server.relationships_functions import insert_new_friendship_request7DB = 'test_app_server'8def test_new_collection_is_empty():9 client = MongoClient()10 coll = client[DB]['videos']11 result = list(coll.find({}))12 client.close()13 assert len(result) == 014### Insert video into db ###15def test_insert_new_video():16 client = MongoClient()17 collection = client[DB]['videos']18 data = {19 'title': 'test',20 'url': 'test.com',21 'user': 'test',22 'isPrivate': True}23 insert_video_into_db('5edbc9196ab5430010391c79', data, collection)24 result = list(collection.find({}))25 first_video = result[0]26 client.close()27 assert len(result) == 128 assert first_video['title'] == 'test'29 assert first_video['is_private']30def test_insert_ten_videos():31 client = MongoClient()32 collection = client[DB]['videos']33 for i in range(0, 10):34 data = {35 'title': 'test_{0}'.format(i),36 'url': 'test.com',37 'user': 'test',38 'isPrivate': False}39 # Esto se hace porque sino el id es repetido y tira conflicto.40 _id = '5edbc9196ab5430010391c7' + str(i)41 insert_video_into_db(_id, data, collection)42 fifth_video = collection.find_one({'title': 'test_5'})43 assert fifth_video is not None44 assert not fifth_video['is_private']45 eleventh_video = collection.find_one({'title': 'test_11'})46 assert eleventh_video is None47 result = list(collection.find({}))48 client.close()49 assert len(result) == 1050 for counter, document in enumerate(result):51 assert document['title'] == 'test_{0}'.format(counter)52def test_insert_duplicate_key_video_fails():53 client = MongoClient()54 collection = client[DB]['videos']55 data = {56 'title': 'test',57 'url': 'test.com',58 'user': 'test',59 'isPrivate': True}60 insert_video_into_db('5edbc9196ab5430010391c79', data, collection)61 response = insert_video_into_db('5edbc9196ab5430010391c79', data, collection)62 client.close()63 assert response == HTTP_INTERNAL_SERVER_ERROR64### Delete video tests ###65def test_delete_video_is_successful():66 client = MongoClient()67 collection = client[DB]['videos']68 data = {69 'title': 'test',70 'url': 'test.com',71 'user': 'test',72 'isPrivate': True}73 _id = '5edbc9196ab5430010391c79'74 insert_video_into_db(_id, data, collection)75 result = list(collection.find({}))76 assert len(result) == 177 status = delete_video_in_db(_id, collection)78 assert status == HTTP_OK79 result = list(collection.find({}))80 assert len(result) == 081 client.close()82def test_delete_video_not_exists():83 client = MongoClient()84 collection = client[DB]['videos']85 data = {'title': 'test',86 'url': 'test.com',87 'user': 'test',88 'isPrivate': True89 }90 _id = '5edbc9196ab5430010391c79'91 insert_video_into_db(_id, data, collection)92 another_id = '66dbc9196ab5430010391c79'93 status = delete_video_in_db(another_id, collection)94 assert status == HTTP_NOT_FOUND95 result = list(collection.find({}))96 assert len(result) == 197 client.close()98## Get video tests ##99def test_get_video_fails_type_error():100 client = MongoClient()101 collection = client[DB]['videos']102 data = {103 'title': 'test',104 'url': 'test.com',105 'user': 'test',106 'isPrivate': True}107 insert_video_into_db('5edbc9196ab5430010391c79', data, collection)108 result = list(collection.find({}))109 assert len(result) == 1110 video_obtained = get_video_by_objectid('test', collection)111 assert video_obtained is None112 client.close()113def test_get_video_successfully():114 client = MongoClient()115 collection = client[DB]['videos']116 data = {117 'title': 'test',118 'url': 'test.com',119 'user': 'test',120 'isPrivate': True}121 insert_video_into_db('5edbc9196ab5430010391c79', data, collection)122 result = list(collection.find({}))123 first_video = result[0]124 assert len(result) == 1125 video_obtained = get_video_by_objectid(ObjectId('5edbc9196ab5430010391c79'), collection)126 assert video_obtained == first_video127 client.close()128def test_get_video_for_response_successfully():129 client = MongoClient()130 collection = client[DB]['videos']131 data = {132 'title': 'test',133 'url': 'test.com',134 'user': 'test',135 'isPrivate': True}136 insert_video_into_db('5edbc9196ab5430010391c79', data, collection)137 result = list(collection.find({}))138 assert len(result) == 1139 video_obtained = get_video_for_response('5edbc9196ab5430010391c79', collection)140 assert video_obtained['_id'] == '5edbc9196ab5430010391c79'141 client.close()142## Filter videos for specific user tests ##143def test_filter_videos_for_specific_user_fails_user_doesnt_exist():144 client = MongoClient()145 collection = client[DB]['videos']146 users_collection = client[DB]['users']147 data = {148 'title': 'test',149 'url': 'test.com',150 'user': 'test',151 'isPrivate': True}152 insert_video_into_db('5edbc9196ab5430010391c79', data, collection)153 result = list(collection.find({}))154 assert len(result) == 1155 filtered_videos = filter_videos_for_specific_user([data], 'test', users_collection, collection)156 assert filtered_videos == []157 client.close()158def test_filter_videos_for_specific_user_successfuly_all_private_videos_non_friends():159 client = MongoClient()160 collection = client[DB]['videos']161 users_collection = client[DB]['users']162 data = {163 'title': 'test',164 'url': 'test.com',165 'user': 'test',166 'isPrivate': True}167 data2 = {168 'title': 'test2',169 'url': 'test2.com',170 'user': 'test2',171 'isPrivate': True}172 _id1 = '5edbc9196ab5430010391c79'173 _id2 = '5edbc9196ab5430010391c78'174 insert_video_into_db(_id1, data, collection)175 insert_video_into_db(_id2, data2, collection)176 data['_id'] = _id1177 data2['_id'] = _id2178 result = list(collection.find({}))179 assert len(result) == 2180 user = {'email': 'prueba@prueba.com', 'full name': 'Prueba'}181 insert_new_user(user, users_collection)182 filtered_videos = filter_videos_for_specific_user([data, data2], 'prueba@prueba.com', users_collection, collection)183 assert len(filtered_videos) == 0184 client.close()185def test_filter_videos_for_specific_user_successfuly_all_public_videos():186 client = MongoClient()187 collection = client[DB]['videos']188 users_collection = client[DB]['users']189 data = {190 'title': 'test',191 'url': 'test.com',192 'user': 'test',193 'isPrivate': False}194 data2 = {195 'title': 'test2',196 'url': 'test2.com',197 'user': 'test2',198 'isPrivate': False}199 _id1 = '5edbc9196ab5430010391c79'200 _id2 = '5edbc9196ab5430010391c78'201 insert_video_into_db(_id1, data, collection)202 insert_video_into_db(_id2, data2, collection)203 data['_id'] = _id1204 data2['_id'] = _id2205 result = list(collection.find({}))206 assert len(result) == 2207 user = {'email': 'prueba@prueba.com', 'full name': 'Prueba'}208 insert_new_user(user, users_collection)209 filtered_videos = filter_videos_for_specific_user([data, data2], 'prueba@prueba.com', users_collection, collection)210 assert len(filtered_videos) == 2211 assert filtered_videos[0] == data212 assert filtered_videos[1] == data2213 client.close()214def test_filter_videos_for_specific_user_successfuly_all_own_videos():215 client = MongoClient()216 collection = client[DB]['videos']217 users_collection = client[DB]['users']218 user_filtering = 'test@test.com'219 data = {220 'title': 'test',221 'url': 'test.com',222 'user': user_filtering,223 'isPrivate': True}224 data2 = {225 'title': 'test2',226 'url': 'test2.com',227 'user': user_filtering,228 'isPrivate': True}229 _id1 = '5edbc9196ab5430010391c79'230 _id2 = '5edbc9196ab5430010391c78'231 insert_video_into_db(_id1, data, collection)232 insert_video_into_db(_id2, data2, collection)233 data['_id'] = _id1234 data2['_id'] = _id2235 result = list(collection.find({}))236 assert len(result) == 2237 user = {'email': user_filtering, 'full name': 'Prueba'}238 insert_new_user(user, users_collection)239 filtered_videos = filter_videos_for_specific_user([data, data2], user_filtering, users_collection, collection)240 assert len(filtered_videos) == 2241 assert filtered_videos[0] == data242 assert filtered_videos[1] == data2243 client.close()244def test_filter_videos_for_specific_user_successfuly_friend_video():245 client = MongoClient()246 collection = client[DB]['videos']247 users_collection = client[DB]['users']248 user1_email = 'prueba@prueba.com'249 user2_email = 'test@test.com'250 data = {251 'title': 'test',252 'url': 'test.com',253 'user': user2_email,254 'isPrivate': True}255 data2 = {256 'title': 'test2',257 'url': 'test2.com',258 'user': 'test2',259 'isPrivate': True}260 _id1 = '5edbc9196ab5430010391c79'261 _id2 = '5edbc9196ab5430010391c78'262 insert_video_into_db(_id1, data, collection)263 insert_video_into_db(_id2, data2, collection)264 data['_id'] = _id1265 data2['_id'] = _id2266 result = list(collection.find({}))267 assert len(result) == 2268 user = {'email': user1_email,269 'full name': 'Prueba',270 'friends': [],271 'requests': []272 }273 user2 = {'email': user2_email,274 'full name': 'Test',275 'friends': [],276 'requests': []277 }278 insert_new_user(user, users_collection)279 insert_new_user(user2, users_collection)280 with patch('app_server.relationships_functions.send_notification_to_user') as _mock:281 insert_new_friendship_request(user2_email, user1_email, users_collection)282 respond_to_friendship_request(user1_email, user2_email, users_collection, accept=True)283 filtered_videos = filter_videos_for_specific_user([data, data2], 'prueba@prueba.com', users_collection, collection)284 assert len(filtered_videos) == 1285 assert filtered_videos[0] == data286 client.close()287## Filter tests ##288def test_filter_public_videos_successfully():289 data = {290 'title': 'test',291 'url': 'test.com',292 'user': 'test',293 'isPrivate': True}294 data2 = {295 'title': 'test2',296 'url': 'test2.com',297 'user': 'test2',298 'isPrivate': False}299 videos_list = [data, data2]300 result = filter_public_videos(videos_list)301 first_video = result[0]302 assert len(result) == 1303 assert first_video['title'] == 'test2'304 assert not first_video['isPrivate']305def test_delete_keys_successfully():306 data = {307 'title': 'test',308 'url': 'test.com',309 'user': 'test',310 'isPrivate': True}311 data2 = {312 'title': 'test2',313 'url': 'test2.com',314 'user': 'test2',315 'isPrivate': False}316 videos_list = [data, data2]317 result = delete_keys_from_videos(videos_list, ['user'])318 first_video = result[0]319 value_expected = {320 'title': 'test',321 'url': 'test.com',322 'isPrivate': True}323 assert len(result) == 2324 assert first_video == value_expected325### Comments test ###326def test_comment_video():327 client = MongoClient()328 collection = client[DB]['videos']329 video_data = {'title': 'test',330 'url': 'test.com',331 'user': 'test',332 'isPrivate': True,333 'comments': []334 }335 _id = '5edbc9196ab5430010391c79'336 insert_video_into_db(_id, video_data, collection)337 user = 'test_01@test.com'338 text = 'Este es un comentario de prueba'339 status_code = insert_comment_into_video(_id, user, text, collection)340 assert status_code == HTTP_CREATED341 this_video = collection.find_one({'_id': ObjectId(_id)})342 assert len(this_video['comments']) == 1343 comment = this_video['comments'][0]344 assert comment['text'] == text345 assert comment['user'] == user346 assert 'timestamp' in comment.keys()347 client.close()348def test_second_comment_video_comes_first():349 client = MongoClient()350 collection = client[DB]['videos']351 video_data = {'title': 'test',352 'url': 'test.com',353 'user': 'test',354 'isPrivate': True,355 'comments': []356 }357 _id = '5edbc9196ab5430010391c79'358 insert_video_into_db(_id, video_data, collection)359 user = 'test_01@test.com'360 text_01 = 'Este es un comentario de prueba'361 insert_comment_into_video(_id, user, text_01, collection)362 text_02 = 'Este es el segundo comentario'363 status_code = insert_comment_into_video(_id, user, text_02, collection)364 assert status_code == HTTP_CREATED365 this_video = collection.find_one({'_id': ObjectId(_id)})366 assert len(this_video['comments']) == 2367 comment = this_video['comments'][0]368 assert comment['text'] == text_02369 assert comment['user'] == user370 assert 'timestamp' in comment.keys()371 client.close()372def test_ten_comments_in_order():373 client = MongoClient()374 collection = client[DB]['videos']375 video_data = {'title': 'test',376 'url': 'test.com',377 'user': 'test',378 'isPrivate': True,379 'comments': []380 }381 _id = '5edbc9196ab5430010391c79'382 insert_video_into_db(_id, video_data, collection)383 user = 'test_01@test.com'384 text = 'Este es el comentario numero {0}'385 for i in range(0, 10):386 text = text.format(i)387 insert_comment_into_video(_id, user, text, collection)388 this_video = collection.find_one({'_id': ObjectId(_id)})389 assert len(this_video['comments']) == 10390 for i in range(10, 0):391 comment = this_video['comments'][i]392 assert comment['text'] == text.format(i)393 client.close()394def test_comment_video_fails_video_does_not_exist():395 client = MongoClient()396 collection = client[DB]['videos']397 video_data = {'title': 'test',398 'url': 'test.com',399 'user': 'test',400 'isPrivate': True,401 'comments': []402 }403 _id = '5edbc9196ab5430010391c79'404 insert_video_into_db(_id, video_data, collection)405 user = 'test_01@test.com'406 text = 'Este es un comentario de prueba'407 __inexistent_id = '5edbc9196ab5430010391c78'408 status_code = insert_comment_into_video(__inexistent_id, user, text, collection)409 assert status_code == HTTP_INTERNAL_SERVER_ERROR410 this_video = collection.find_one({'_id': ObjectId(_id)})411 assert len(this_video['comments']) == 0...

Full Screen

Full Screen

AnimationProcs.py

Source:AnimationProcs.py Github

copy

Full Screen

1#Embedded file name: c:/depot/games/branches/release/EVE-TRANQUILITY/carbon/common/script/zaction/AnimationProcs.py2import actionProperties3import batma4import blue5import yaml6import zaction7animInfoDict = None8def GetAnimInfo():9 global animInfoDict10 if animInfoDict is None:11 dataFile = blue.ResFile()12 dataFile.Open('res:/Animation/animInfo.yaml')13 animInfoDict = yaml.load(dataFile)14 dataFile.close()15 return animInfoDict16def GetAnimPropertyByName(animName, propertyName):17 animInfo = GetAnimInfo()18 anim = animInfo.get(animName, None)19 if anim is not None:20 return anim.get(propertyName, None)21def _AnimationProcNameHelper(name, procRow):22 propDict = actionProperties.GetPropertyValueDict(procRow)23 animName = propDict.get('AnimName', 'None')24 duration = GetAnimPropertyByName(animName, 'duration')25 if duration is None:26 duration = 0.027 displayName = 'PerformAnim ' + animName + ' for ' + str(duration) + ' sec'28 return displayName29def AnimationProcNameHelper(name):30 return lambda procRow: _AnimationProcNameHelper(name, procRow)31def GetControlParameters(propRow):32 validList = ['HeadLookWeight',33 'HeadBlendSpeed',34 'Aim_X',35 'Aim_Y',36 'AllowFidgets']37 retList = []38 for param in validList:39 retList.append((param, param, ''))40 retList.sort()41 return retList42exports = {'actionProperties.ControlParameters': ('listMethod', GetControlParameters),43 'actionProcTypes.OrAllCondition': zaction.ProcTypeDef(isMaster=True, isConditional=True, procCategory='Condition', displayName=' Or All', properties=[zaction.ProcPropertyTypeDef('NegateAll', 'B', isPrivate=True, default=False)], description="Conditional procs can be used to modify the result of a conditional step or prereq container. Only a single Conditional proc will be respected, so don't use more than one. \n\nOr All: For all procs in this ProcContainer, evaluate to True if any of them returns True.\nThe Negate All option will cause this to evaluate True if any of them returns False."),44 'actionProcTypes.AndAllCondition': zaction.ProcTypeDef(isMaster=True, isConditional=True, procCategory='Condition', displayName=' And All', properties=[zaction.ProcPropertyTypeDef('NegateAll', 'B', isPrivate=True, default=False)], description="Conditional procs can be used to modify the result of a conditional step or prereq container. Only a single Conditional proc will be respected, so don't use more than one. \n\nAnd All: For all procs in this ProcContainer, evaluate to True if all of them return True. This is the default behavior for ProcContainers so... you may not even need this unless you use...\nThe Negate All option will cause this to evaluate True if all of them return False."),45 'actionProcTypes.NotCondition': zaction.ProcTypeDef(isMaster=True, isConditional=True, procCategory='Condition', displayName=' Not', properties=[], description="Conditional procs can be used to modify the result of a conditional step or prereq container. Only a single Conditional proc will be respected, so don't use more than one. \n\nNot: For all procs in this ProcContainer, evaluate to True if all of them return False. "),46 'actionProcTypes.XorCondition': zaction.ProcTypeDef(isMaster=True, isConditional=True, procCategory='Condition', displayName=' Xor', properties=[zaction.ProcPropertyTypeDef('NegateAll', 'B', isPrivate=True, default=False)], description="Conditional procs can be used to modify the result of a conditional step or prereq container. Only a single Conditional proc will be respected, so don't use more than one. \n\nXor: For all procs in this ProcContainer, evaluate to True if exactly one of them is True.\nThe Negate All option will cause this to evaluate True if not exactly one is True."),47 'actionProcTypes.ComplexCondition': zaction.ProcTypeDef(isMaster=True, isConditional=True, procCategory='Condition', displayName=' Complex Condition %(ConditionEvalString)s', properties=[zaction.ProcPropertyTypeDef('ConditionEvalString', 'S', isPrivate=True)], description="Conditional procs can be used to modify the result of a conditional step or prereq container. Only a single Conditional proc will be respected, so don't use more than one. \n\nComplex: The ConditionEvalString is a reverse polish notation string with ,&|! as delimiters. Specific procs are referenced by their proc IDs.\n\nFor example, if you want the condition to evaluate true if Proc 4 and Proc 11 are True or Proc 8 is False, then you would use the EvalString:\n4,11&8!|\n\nYes, we realize this is fugly, but until enough people are even using it that it matters, it's not really in the schedule to make the user interface for this especially usable."),48 'actionProcTypes.ChangeAction': zaction.ProcTypeDef(isMaster=True, procCategory='Action', displayName=zaction.ProcNameHelper('ChangeAction to %(NewAction)s'), properties=[zaction.ProcPropertyTypeDef('NewAction', 'I', userDataType='ActionChildrenAndSiblingsList', isPrivate=True)], description='Attempt to transition from the current action on this tree instance to another action in thesame tree. This requires valid availability on the action tree.\n\nThis will not allow you to begin actions on other trees. IE, buffs cannot start decision actions'),49 'actionProcTypes.ExitAction': zaction.ProcTypeDef(isMaster=True, procCategory='Action', properties=[], description='Clear the current actions step stack causing this action to finish upon completion of the step.'),50 'actionProcTypes.LogMessage': zaction.ProcTypeDef(isMaster=True, procCategory='General', properties=[zaction.ProcPropertyTypeDef('LogCategory', 'I', userDataType='LogCategory', isPrivate=True), zaction.ProcPropertyTypeDef('LogMessage', 'S', isPrivate=True)], description='Output a message to the log server.'),51 'actionProcTypes.WaitForTime': zaction.ProcTypeDef(isMaster=True, procCategory='General', properties=[zaction.ProcPropertyTypeDef('Duration', 'F', isPrivate=True)], description='Hold the current step open for a fixed amount of time.'),52 'actionProcTypes.CooldownForTime': zaction.ProcTypeDef(isMaster=True, isConditional=True, procCategory='General', properties=[zaction.ProcPropertyTypeDef('Duration', 'F', isPrivate=True)]),53 'actionProcTypes.CreateProperty': zaction.ProcTypeDef(isMaster=False, isConditional=False, procCategory='General', properties=[zaction.ProcPropertyTypeDef('CreateName', 'S', isPrivate=True), zaction.ProcPropertyTypeDef('CreateType', 'S', userDataType='PropertyType', isPrivate=True), zaction.ProcPropertyTypeDef('CreateValue', 'S', isPrivate=True)], description='Create a public property in the Action PropertyList.'),54 'actionProcTypes.WaitForever': zaction.ProcTypeDef(isMaster=True, procCategory='General', description='Hold the current step open forever. Note that this should only ever be used within a try block.'),55 'actionProcTypes.LogPropertyList': zaction.ProcTypeDef(isMaster=True, procCategory='General', description='Output the entire contents of the current actions property list to the log server. Spammy.'),56 'actionProcTypes.HasTargetList': zaction.ProcTypeDef(isMaster=True, procCategory='Target', isConditional=True, description='Returns True if the target list contains at least a single target.'),57 'actionProcTypes.StartTargetAction': zaction.ProcTypeDef(isMaster=True, procCategory='Action', properties=[zaction.ProcPropertyTypeDef('TargetAction', 'I', userDataType='ActionList', isPrivate=False)], description='Starts an action in the action tree on the first entity in the target list.\n\nUseful for syncing actions.'),58 'actionProcTypes.HasLockedTarget': zaction.ProcTypeDef(isMaster=True, procCategory='Target', isConditional=True, description='Returns true if a synced action has set a locked target.\n\nUseful for syncing actions.'),59 'actionProcTypes.UseLockedTarget': zaction.ProcTypeDef(isMaster=True, procCategory='Target', description='Takes the current locked target it and places it in the TargetList property\n\nUseful for syncing actions.'),60 'actionProcTypes.CanTargetStartAction': zaction.ProcTypeDef(isMaster=True, procCategory='Action', isConditional=True, properties=[zaction.ProcPropertyTypeDef('TargetAction', 'I', userDataType='ActionList', isPrivate=False)], description='Returns true if the target entity can validly request the specified action.\n\nUseful for syncing actions.'),61 'actionProcTypes.CanLockedTargetStartAction': zaction.ProcTypeDef(isMaster=True, procCategory='Action', isConditional=True, properties=[zaction.ProcPropertyTypeDef('TargetAction', 'I', userDataType='ActionList', isPrivate=False)], description='Returns true if the locked target can validly request the specified action.\n\nUseful for syncing actions.'),62 'actionProcTypes.PerformAnim': zaction.ProcTypeDef(isMaster=True, procCategory='Animation', displayName=AnimationProcNameHelper('%(AnimName)s'), properties=[zaction.ProcPropertyTypeDef('AnimName', 'S', userDataType='AnimationListDialogWrapper', isPrivate=True)], description='Will attempt to perform the specified animation request as defined in the animInfo.yaml'),63 'actionProcTypes.SetPose': zaction.ProcTypeDef(isMaster=True, procCategory='Animation', displayName='SetPose %(AnimName)s', properties=[zaction.ProcPropertyTypeDef('AnimName', 'S', userDataType=None, isPrivate=True)]),64 'actionProcTypes.PerformSyncAnim': zaction.ProcTypeDef(isMaster=True, procCategory='Animation', displayName='PerformSyncAnim %(AnimName)s', properties=[zaction.ProcPropertyTypeDef('AnimName', 'S', userDataType=None, isPrivate=True)]),65 'actionProcTypes.FaceTarget': zaction.ProcTypeDef(isMaster=True, procCategory='Animation', description="Causes the current entity to turn and face it's target."),66 'actionProcTypes.IsFacingTarget': zaction.ProcTypeDef(isMaster=True, procCategory='Animation', isConditional=True, properties=[zaction.ProcPropertyTypeDef('TargetFacingAngle', 'F', isPrivate=True)], description="Returns true if the current entity is facing it's target."),67 'actionProcTypes.SetSyncAnimEntry': zaction.ProcTypeDef(isMaster=False, procCategory='Animation', displayName='SetSyncAnimEntry %(AnimName)s', properties=[zaction.ProcPropertyTypeDef('AnimName', 'S', userDataType=None, isPrivate=True)]),68 'actionProcTypes.GetEntryFromAttacker': zaction.ProcTypeDef(isMaster=False, procCategory='Animation'),69 'actionProcTypes.IsEntityInRange': zaction.ProcTypeDef(isMaster=False, isConditional=True, procCategory='Animation', properties=[zaction.ProcPropertyTypeDef('Range', 'F', userDataType=None, isPrivate=True)], description='Returns true if the target entity is within the specified range.'),70 'actionProcTypes.SlaveMode': zaction.ProcTypeDef(isMaster=True, procCategory='Animation', properties=[zaction.ProcPropertyTypeDef('BoneName', 'S', userDataType=None, isPrivate=True)]),71 'actionProcTypes.AlignToMode': zaction.ProcTypeDef(isMaster=True, procCategory='Animation'),72 'actionProcTypes.PathToMode': zaction.ProcTypeDef(isMaster=True, procCategory='Animation', properties=[zaction.ProcPropertyTypeDef('PathDistance', 'F', userDataType=None, isPrivate=True)], description='Paths the requesting entity to within the specified distance of the ALIGN_POS.'),73 'actionProcTypes.WanderMode': zaction.ProcTypeDef(isMaster=True, procCategory='Animation', properties=[]),74 'actionProcTypes.RestoreMoveMode': zaction.ProcTypeDef(isMaster=True, procCategory='Animation'),75 'actionProcTypes.RestoreTargetMoveMode': zaction.ProcTypeDef(isMaster=True, procCategory='Animation'),...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Contexts automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful