本文整理汇总了Python中soc.modules.seeder.logic.seeder.logic.seed函数的典型用法代码示例。如果您正苦于以下问题:Python seed函数的具体用法?Python seed怎么用?Python seed使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了seed函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: setUp
def setUp(self):
self.valid_list_id = 'valid_cached_list'
self.invalid_list_id = 'invalid_cached_list'
self.processing_list_id = 'processing_cached_list'
self.not_processing_list_id = 'not_processing_cached_list'
valid_cached_list_properties = {
'id': self.valid_list_id,
'valid_through': datetime.datetime.max
}
self.valid_list = seeder_logic.seed(
cached_list_model.CachedList, valid_cached_list_properties)
invalid_cached_list_properties = {
'id': self.invalid_list_id,
'valid_through': datetime.datetime.min
}
self.invalid_list = seeder_logic.seed(
cached_list_model.CachedList, invalid_cached_list_properties)
processing_cached_list_properties = {
'id': self.processing_list_id,
'is_processing': True
}
self.processing_list = seeder_logic.seed(
cached_list_model.CachedList, processing_cached_list_properties)
not_processing_cached_list_properties = {
'id': self.not_processing_list_id,
'is_processing': False
}
self.processing_list = seeder_logic.seed(
cached_list_model.CachedList, not_processing_cached_list_properties)
开发者ID:rhyolight,项目名称:nupic.son,代码行数:33,代码来源:test_cached_list.py
示例2: setUp
def setUp(self):
self.gsoc_program = seeder_logic.seed(GSoCProgram)
self.gsoc_organization = seeder_logic.seed(GSoCOrganization,
{'scope': self.gsoc_program})
slot_transfer_properties = {'program': self.gsoc_program,
'status': 'accepted'}
organization_properties = {'scope': self.gsoc_program}
self.org_entities = seeder_logic.seedn(GSoCOrganization, 10,
organization_properties)
#Assign one slot transfer entity to each of the organization in
#self.org_entities
self.slot_transfer_entities = []
properties = slot_transfer_properties.copy()
for i in range(10):
properties['parent'] = self.org_entities[i]
entity = seeder_logic.seed(GSoCSlotTransfer, properties)
self.slot_transfer_entities.append(entity)
#Assign multiple slot transfer entities to self.gsoc_organization
properties = slot_transfer_properties.copy()
properties.update({'parent': self.gsoc_organization})
self.gsoc_organization_slot_transfer_entities = seeder_logic.seedn(
GSoCSlotTransfer, 5, properties)
开发者ID:adviti,项目名称:melange,代码行数:25,代码来源:test_slot_transfer.py
示例3: setUp
def setUp(self):
self.user = profile_utils.seedNDBUser()
self.program = program_utils.seedProgram()
self.gsoc_program = program_utils.seedGSoCProgram()
self.gci_program = program_utils.seedGCIProgram()
self.site = seeder_logic.seed(Site, {'key_name': 'site'})
self.organization = seeder_logic.seed(Organization)
self.gsoc_organization = org_utils.seedSOCOrganization(
self.gsoc_program.key())
self.gci_organization = seeder_logic.seed(GCIOrganization)
self.program_key_name = self.program.key().name()
self.gsoc_program_key_name = self.gsoc_program.key().name()
self.gci_program_key_name = self.gci_program.key().name()
self.site_key_name = self.site.key().name()
self.org_key_name = self.organization.key().name()
self.gsoc_org_key_name = self.gsoc_organization.key.id()
self.gci_org_key_name = self.gci_organization.key().name()
开发者ID:rhyolight,项目名称:nupic.son,代码行数:26,代码来源:test_prefixes.py
示例4: testListData
def testListData(self):
user = profile_utils.seedNDBUser(host_for=[self.program])
profile_utils.loginNDB(user)
properties = {
'program': self.gsoc,
'nr_slots': 3,
'remarks': 'Sample Remark',
'status': 'pending',
}
# seed slot transfer entity for self.org
properties['parent'] = self.org.key.to_old_key()
seeder_logic.seed(slot_transfer_model.GSoCSlotTransfer, properties)
other_org = org_utils.seedSOCOrganization(
self.program.key(), status=org_model.Status.ACCEPTED)
# seed slot transfer entity for other_org
properties['parent'] = other_org.key.to_old_key()
seeder_logic.seed(slot_transfer_model.GSoCSlotTransfer, properties)
response = self.get(self.url)
self.assertResponseOK(response)
list_data = self.getListData(self.url, 0)
self.assertEqual(len(list_data), 2)
开发者ID:rhyolight,项目名称:nupic.son,代码行数:27,代码来源:test_slot_transfer_admin.py
示例5: testAcceptedOrgsAreDisplayedAfterOrganizationsHaveBeenAnnounced
def testAcceptedOrgsAreDisplayedAfterOrganizationsHaveBeenAnnounced(self):
"""Tests that the list of the organizations can not be accessed before
organizations have been announced.
"""
org_properties = {'scope': self.gsoc, 'status': 'active'}
seeder_logic.seed(GSoCOrganization, org_properties)
seeder_logic.seed(GSoCOrganization, org_properties)
self.timeline.orgsAnnounced()
response = self.get(self.url1)
self.assertResponseOK(response)
self.assertAcceptedOrgsPageTemplatesUsed(response)
list_data = self.getListData(self.url1, 0)
#Third organization is self.gsoc
self.assertEqual(len(list_data), 3)
response = self.get(self.url2)
self.assertResponseOK(response)
self.assertAcceptedOrgsPageTemplatesUsed(response)
list_data = self.getListData(self.url2, 0)
self.assertEqual(len(list_data), 3)
response = self.get(self.url3)
self.assertResponseOK(response)
self.assertAcceptedOrgsPageTemplatesUsed(response)
list_data = self.getListData(self.url3, 0)
self.assertEqual(len(list_data), 3)
开发者ID:adviti,项目名称:melange,代码行数:27,代码来源:test_accepted_orgs.py
示例6: testTasksWithFilters
def testTasksWithFilters(self):
"""Tests with applying a filters on properties."""
# seed another organization
other_org = seeder_logic.seed(org_model.GCIOrganization)
# seed another task for that organization and the seeded mentor
task_properties = {
"mentors": [self.profile.key()],
"status": task_model.CLAIMED,
"org": other_org,
"student": None,
}
other_task = seeder_logic.seed(task_model.GCITask, properties=task_properties)
# check querying tasks for organization filter
extra_filters = {task_model.GCITask.org: [self.org]}
query = task_logic.queryTasksForMentor(self.profile.key(), extra_filters=extra_filters)
self.assertSetEqual(set(entity.key() for entity in query), set([self.task1.key(), self.task2.key()]))
# check querying tasks for status filter
extra_filters = {task_model.GCITask.status: [task_model.CLAIMED, task_model.OPEN]}
query = task_logic.queryTasksForMentor(self.profile.key(), extra_filters=extra_filters)
self.assertSetEqual(
set(entity.key() for entity in query), set([self.task1.key(), self.task2.key(), other_task.key()])
)
开发者ID:rhyolight,项目名称:nupic.son,代码行数:25,代码来源:test_task.py
示例7: createMentorWithProject
def createMentorWithProject(self, org):
"""Creates an mentor profile with a project for the current user.
"""
self.createMentor(org)
from soc.modules.gsoc.models.student_project import StudentProject
properties = {'mentor': self.profile}
seeder_logic.seed(StudentProject, properties)
开发者ID:SRabbelier,项目名称:Melange,代码行数:7,代码来源:profile_utils.py
示例8: setUp
def setUp(self):
self.program = seeder_logic.seed(GSoCProgram)
organization_properties = {'program': self.program}
self.foo_organization = seeder_logic.seed(GSoCOrganization,
organization_properties)
#create mentors for foo_organization.
self.foo_mentors = []
for i in range(5):
email = 'foomentor%[email protected]' % str(i)
mentor = self.createMentor(email, self.foo_organization)
self.foo_mentors.append(mentor)
#create organization admins for foo_organization.
self.foo_org_admins = []
for i in range(5):
email = 'fooorgadmin%[email protected]' % str(i)
admin = self.createOrgAdmin(email, self.foo_organization)
self.foo_org_admins.append(admin)
#create another organization bar_organization for our program.
self.bar_organization = seeder_logic.seed(GSoCOrganization,
organization_properties)
#assign mentors for bar_organization.
self.bar_mentors = []
for i in range(5):
email = 'barmentor%[email protected]' % str(i)
mentor = self.createMentor(email, self.bar_organization)
self.bar_mentors.append(mentor)
#assign an organization admin for bar_organization
email = '[email protected]'
self.bar_org_admin = self.createOrgAdmin(email, self.bar_organization)
开发者ID:adviti,项目名称:melange,代码行数:32,代码来源:test_profile.py
示例9: testMentorPassingRecord
def testMentorPassingRecord(self):
"""Tests when mentor record passes the project."""
# seed sudent record
properties = {
'project': self.project,
'survey': self.student_evaluation,
}
student_record = seeder_logic.seed(
project_survey_record_model.GSoCProjectSurveyRecord,
properties=properties)
# seed mentor record with a passing grade
properties = {
'project': self.project,
'grade': True,
'survey': self.mentor_evaluation
}
mentor_record = seeder_logic.seed(
grading_project_survey_record_model.GSoCGradingProjectSurveyRecord,
properties=properties)
fields = grading_record_logic.getFieldsForGradingRecord(
self.project, self.survey_group)
# check that both records are returned
self.assertEqual(fields['student_record'].key(), student_record.key())
self.assertEqual(fields['mentor_record'].key(), mentor_record.key())
# check that grade decision is 'fail'
self.assertEqual(fields['grade_decision'], grading_record_model.GRADE_PASS)
开发者ID:rhyolight,项目名称:nupic.son,代码行数:30,代码来源:test_grading_record.py
示例10: testSeedingNdbKeyPropertySpecified
def testSeedingNdbKeyPropertySpecified(self):
"""Tests the entity can be seeded properly if ndb KeyProperty specified."""
ndb_dummy_entity = seeder_logic.seed(ndb_models.NdbDummyModel)
entity = seeder_logic.seed(ndb_models.NdbKeyProperty,
properties={'key': ndb_dummy_entity.key})
self.assertIsNotNone(entity)
self.assertIsInstance(entity.key, ndb.Key)
self.assertIsInstance(entity._properties['key'], ndb.KeyProperty)
开发者ID:rhyolight,项目名称:nupic.son,代码行数:8,代码来源:test_seeder.py
示例11: setUp
def setUp(self):
self.program = program_utils.seedGCIProgram()
org_properties = {
'program': self.program
}
self.foo_org = seeder_logic.seed(GCIOrganization, org_properties)
self.bar_org = seeder_logic.seed(GCIOrganization, org_properties)
开发者ID:rhyolight,项目名称:nupic.son,代码行数:8,代码来源:test_profile.py
示例12: testTimelineForProgram
def testTimelineForProgram(self):
# seed a new program and a timeline for it
properties = {"key_name": "test_keyname"}
timeline = seeder_logic.seed(timeline_model.Timeline, properties)
program = seeder_logic.seed(program_model.Program, properties)
result = timeline_logic.isTimelineForProgram(timeline.key(), program.key())
self.assertTrue(result)
开发者ID:rhyolight,项目名称:nupic.son,代码行数:8,代码来源:test_timeline.py
示例13: createStudentWithProject
def createStudentWithProject(self):
"""Sets the current user to be a student with a project for the current program.
"""
self.createStudentWithProposal()
from soc.modules.gsoc.models.student_project import StudentProject
properties = {'link_id': self.profile.link_id, 'scope': self.profile,
'student': self.profile, 'parent': self.profile}
seeder_logic.seed(StudentProject, properties)
开发者ID:SRabbelier,项目名称:Melange,代码行数:8,代码来源:profile_utils.py
示例14: createStudentWithProposal
def createStudentWithProposal(self):
"""Sets the current user to be a student with a proposal for the current program.
"""
self.createStudent()
from soc.modules.gsoc.models.proposal import GSoCProposal
properties = {'link_id': self.profile.link_id, 'scope': self.profile,
'parent': self.profile, 'status': 'new'}
seeder_logic.seed(GSoCProposal, properties)
开发者ID:SRabbelier,项目名称:Melange,代码行数:8,代码来源:profile_utils.py
示例15: setUp
def setUp(self):
self.user = seeder_logic.seed(User)
self.program_timeline = seeder_logic.seed(GSoCTimeline)
program_properties = {'timeline': self.program_timeline, 'scope': self.user}
self.program = seeder_logic.seed(Program, program_properties)
self.gsoc_program = seeder_logic.seed(GSoCProgram, program_properties)
self.gci_program = seeder_logic.seed(GCIProgram, program_properties)
self.site = seeder_logic.seed(Site,)
self.organization = seeder_logic.seed(Organization)
self.gsoc_organization = seeder_logic.seed(GSoCOrganization)
self.gci_organization = seeder_logic.seed(GCIOrganization)
self.user_key_name = self.user.key().name()
self.program_key_name = self.program.key().name()
self.gsoc_program_key_name = self.gsoc_program.key().name()
self.gci_program_key_name = self.gci_program.key().name()
self.site_key_name = self.site.key().name()
self.org_key_name = self.organization.key().name()
self.gsoc_org_key_name = self.gsoc_organization.key().name()
self.gci_org_key_name = self.gci_organization.key().name()
开发者ID:adviti,项目名称:melange,代码行数:29,代码来源:test_prefixes.py
示例16: setUp
def setUp(self):
"""See unittest.TestCase.setUp for specification."""
# seed an organization
self.org = seeder_logic.seed(org_model.GCIOrganization)
# seed a user
self.profile = seeder_logic.seed(profile_model.GCIProfile)
# seed a task
task_properties = {'org': self.org}
self.task = seeder_logic.seed(
task_model.GCITask, properties=task_properties)
开发者ID:rhyolight,项目名称:nupic.son,代码行数:12,代码来源:test_profile.py
示例17: testClosedTasksList
def testClosedTasksList(self):
"""Tests if the list of open tasks is rendered.
"""
task_prop = {'status': 'Closed', 'program': self.gci, 'org': self.org}
seeder_logic.seed(GCITask, task_prop)
seeder_logic.seed(GCITask, task_prop)
response = self.get(self.url)
self.assertResponseOK(response)
self.assertTemplatesUsed(response)
idx = 1
list_data = self.getListData(self.url, idx)
self.assertEqual(len(list_data), 2)
开发者ID:rhyolight,项目名称:nupic.son,代码行数:12,代码来源:test_org_home.py
示例18: setUp
def setUp(self):
"""See unittest.TestCase.setUp for specification."""
self.init()
# TODO (daniel): Edit Site Page should work without an active program
program = seeder_logic.seed(program_model.Program)
site_properties = {
'key_name': 'site',
'active_program': program,
'tos': None,
}
self.site = seeder_logic.seed(site_model.Site, properties=site_properties)
开发者ID:rhyolight,项目名称:nupic.son,代码行数:13,代码来源:test_site.py
示例19: setUp
def setUp(self):
"""See unittest.TestCase.setUp for specification."""
# seed an organization
self.org = seeder_logic.seed(org_model.GCIOrganization)
# seed a mentor
profile_properties = {"is_mentor": True, "mentor_for": [self.org.key()]}
self.profile = seeder_logic.seed(profile_model.GCIProfile, profile_properties)
# seed a few tasks for the seeded mentor
task_properties = {"mentors": [self.profile.key()], "status": task_model.OPEN, "org": self.org, "student": None}
self.task1 = seeder_logic.seed(task_model.GCITask, properties=task_properties)
self.task2 = seeder_logic.seed(task_model.GCITask, properties=task_properties)
开发者ID:rhyolight,项目名称:nupic.son,代码行数:13,代码来源:test_task.py
示例20: setUp
def setUp(self):
"""See unittest.TestCase.setUp for specification."""
self.program = seeder_logic.seed(program_model.Program)
self.org = org_utils.seedOrganization(
self.program.key(), org_id=TEST_ORG_ID, name=TEST_ORG_NAME)
self.app_response = survey_model.SurveyResponse(parent=self.org.key)
self.app_response.put()
开发者ID:rhyolight,项目名称:nupic.son,代码行数:7,代码来源:test_organization.py
注:本文中的soc.modules.seeder.logic.seeder.logic.seed函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论