def setUp(self): # Every test needs a client. self.client = Client() userList = [{ 'username': '******', 'department': 'cs', 'name': 'Ayush', 'course': 'btech', 'hostel': 'siang', 'gender': 'm' }, { 'username': '******', 'department': 'cs', 'name': 'sdg', 'course': 'btech', 'hostel': 'kameng', 'gender': 'm' }, { 'username': '******', 'department': 'ee', 'name': 'Nice Name', 'course': 'mtech', 'hostel': 'subuansiri', 'gender': 'f' }, { 'username': '******', 'department': 'dd', 'name': 'Hiyaa', 'course': 'phd', 'hostel': 'siang', 'gender': 'm' }] self.passy = databaseManager.registerUsers(userList) self.superusers = User.objects.create_superuser( username='******', password='******', email='*****@*****.**')
def setUp(self): Posts.objects.create(postname="Vice President", info_fields="[{'description': u'Name', 'type': u'text', 'id': 'field0', 'validation': u'', 'placeholder': u'', 'options': u''}, {'description': u'Gender', 'type': u'radio', 'id': 'field1', 'validation': u'', 'placeholder': u'', 'options': u'Male; Female'}, {'description': u'Agenda', 'type': u'file', 'id': 'field2', 'validation': u'.*\.pdf', 'placeholder': u'', 'options': u''}]") userList = [{'username':'******', 'department':'cse', 'name':'Ayush', 'course':'btech', 'hostel' : 'Siang'}, {'username':'******', 'department':'cse', 'name':'sdg', 'course':'btech', 'hostel' : 'Kameng'}, {'username':'******', 'department':'ece', 'name':'Nice Name', 'course':'mtech', 'hostel' : 'Subuansiri'}, {'username':'******', 'department':'des', 'name':'Hiyaa', 'course':'phd', 'hostel' : 'Siang'} ] self.passy = databaseManager.registerUsers(userList)
def setUp(self): Posts.objects.create(postname="Vice President", postCount=1, eligibleGender='a', eligibleCourse='a', info_fields="[{'description': u'Name', 'type': u'text', 'id': 'field0', 'validation': u'', 'placeholder': u'', 'options': u''}, {'description': u'Gender', 'type': u'radio', 'id': 'field1', 'validation': u'', 'placeholder': u'', 'options': u'Male; Female'}, {'description': u'Agenda', 'type': u'file', 'id': 'field2', 'validation': u'.*\.pdf', 'placeholder': u'', 'options': u''}]") userList = [{'username':'******', 'department':'cs', 'name':'Ayush', 'course':'btech', 'hostel' : 'siang', 'gender': 'm'}, {'username':'******', 'department':'cs', 'name':'sdg', 'course':'btech', 'hostel' : 'kameng', 'gender': 'm'}, {'username':'******', 'department':'ee', 'name':'Nice Name', 'course':'mtech', 'hostel' : 'subuansiri', 'gender': 'f'}, {'username':'******', 'department':'dd', 'name':'Hiyaa', 'course':'phd', 'hostel' : 'siang', 'gender': 'm'} ] self.passy = databaseManager.registerUsers(userList) GlobalVariables(varname='electionState', value='election').save()
def setUp(self): # Every test needs a client. # f62a6eec3d340b45f857 self.client = Client() userList = [{'username':'******', 'department':'cs', 'name':'Ayush', 'course':'btech', 'hostel' : 'siang', 'gender': 'm'}, {'username':'******', 'department':'cs', 'name':'sdg', 'course':'btech', 'hostel' : 'kameng', 'gender': 'm'}, {'username':'******', 'department':'ee', 'name':'Nice Name', 'course':'mtech', 'hostel' : 'subuansiri', 'gender': 'f'}, {'username':'******', 'department':'dd', 'name':'Hiyaa', 'course':'phd', 'hostel' : 'siang', 'gender': 'm'} ] self.passy = databaseManager.registerUsers(userList) self.superusers = User.objects.create_superuser(username = '******',password = '******', email = '*****@*****.**')
def setUp(self): Posts.objects.create( postname="Vice President", postCount=1, eligibleGender='a', eligibleCourse='a', info_fields= "[{'description': u'Name', 'type': u'text', 'id': 'field0', 'validation': u'', 'placeholder': u'', 'options': u''}, {'description': u'Gender', 'type': u'radio', 'id': 'field1', 'validation': u'', 'placeholder': u'', 'options': u'Male; Female'}, {'description': u'Agenda', 'type': u'file', 'id': 'field2', 'validation': u'.*\.pdf', 'placeholder': u'', 'options': u''}]" ) userList = [{ 'username': '******', 'department': 'cs', 'name': 'Ayush', 'course': 'btech', 'hostel': 'siang', 'gender': 'm' }, { 'username': '******', 'department': 'cs', 'name': 'sdg', 'course': 'btech', 'hostel': 'kameng', 'gender': 'm' }, { 'username': '******', 'department': 'ee', 'name': 'Nice Name', 'course': 'mtech', 'hostel': 'subuansiri', 'gender': 'f' }, { 'username': '******', 'department': 'dd', 'name': 'Hiyaa', 'course': 'phd', 'hostel': 'siang', 'gender': 'm' }] self.passy = databaseManager.registerUsers(userList) GlobalVariables(varname='electionState', value='election').save()
import os from mainSite import databaseManager from django.core.management import call_command call_command('makemigrations', interactive = False) call_command('migrate', interactive = False) # call_command('syncdb', interactive = False) userList = [{'username':'******', 'department':'cse', 'name':'Ayush', 'course':'btech', 'hostel' : 'Siang'}, {'username':'******', 'department':'cse', 'name':'sdg', 'course':'btech', 'hostel' : 'Kameng'}, {'username':'******', 'department':'ece', 'name':'Nice Name', 'course':'mtech', 'hostel' : 'Subuansiri'}, {'username':'******', 'department':'des', 'name':'Hiyaa', 'course':'phd', 'hostel' : 'Siang'} ] passy = databaseManager.registerUsers(userList) databaseManager.makeCandidate('adgfd','[{"id": "field0", "type": "text", "value": "Ad Fg Jkl"}, {"id": "field1", "type": "radio", "value": "Male"}, {"id": "field2", "type": "file", "value": "/agendas/not-available.pdf"}]', 'Vice President', '/static/candidates/photos/adgfd.jpg', True) from mainSite.models import Posts post = Posts(postname="Vice President", info_fields="[{'description': u'Name', 'type': u'text', 'id': 'field0', 'validation': u'', 'placeholder': u'', 'options': u''}, {'description': u'Gender', 'type': u'radio', 'id': 'field1', 'validation': u'', 'placeholder': u'', 'options': u'Male; Female'}, {'description': u'Agenda', 'type': u'file', 'id': 'field2', 'validation': u'*.pdf', 'placeholder': u'', 'options': u''}]") post.save() print passy databaseManager.registerVote("some text pertaining to a vote", "kayush", passy[0]) databaseManager.registerVote("some text pertaining to a vote", "kayush", passy[0]) databaseManager.registerVote("some text pertaining to a vote", "kayush", passy[0]) #sampe post info_fields #[{'description': u'Name', 'type': u'text', 'id': 'field0', 'validation': u'', 'placeholder': u'Your Name', 'options': u''}, {'description': u'Date of Birth', 'type': u'text', 'id': 'field1', 'validation': u'[0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9]', 'placeholder': u'DOB - dd-mm-yyyy', 'options': u''}, {'description': u'Agenda', 'type': u'file', 'id': 'field2', 'validation': u'.*.pdf', 'placeholder': u'', 'options': u''}]
'hostel': 'Kameng' }, { 'username': '******', 'department': 'ece', 'name': 'Nice Name', 'course': 'mtech', 'hostel': 'Subuansiri' }, { 'username': '******', 'department': 'des', 'name': 'Hiyaa', 'course': 'phd', 'hostel': 'Siang' }] passy = databaseManager.registerUsers(userList) databaseManager.makeCandidate( 'adgfd', '[{"id": "field0", "type": "text", "value": "Ad Fg Jkl"}, {"id": "field1", "type": "radio", "value": "Male"}, {"id": "field2", "type": "file", "value": "/agendas/not-available.pdf"}]', 'Vice President', '/static/candidates/photos/adgfd.jpg', True) from mainSite.models import Posts post = Posts( postname="Vice President", info_fields= "[{'description': u'Name', 'type': u'text', 'id': 'field0', 'validation': u'', 'placeholder': u'', 'options': u''}, {'description': u'Gender', 'type': u'radio', 'id': 'field1', 'validation': u'', 'placeholder': u'', 'options': u'Male; Female'}, {'description': u'Agenda', 'type': u'file', 'id': 'field2', 'validation': u'*.pdf', 'placeholder': u'', 'options': u''}]" ) post.save() print passy