示例#1
0
 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='*****@*****.**')
示例#2
0
文件: tests.py 项目: sowmya05/gems
	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)
示例#3
0
	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()
示例#4
0
	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 = '*****@*****.**')
示例#5
0
 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()
示例#6
0
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''}]
示例#7
0
    '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