本文整理汇总了Python中agilito.models.UserStory.save方法的典型用法代码示例。如果您正苦于以下问题:Python UserStory.save方法的具体用法?Python UserStory.save怎么用?Python UserStory.save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类agilito.models.UserStory
的用法示例。
在下文中一共展示了UserStory.save方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_partial_case
# 需要导入模块: from agilito.models import UserStory [as 别名]
# 或者: from agilito.models.UserStory import save [as 别名]
def test_partial_case(self):
it = Iteration(start_date=datetime.datetime.now(), end_date=datetime.datetime.now(), project=self.p1)
it.save()
us1 = UserStory(name='User story A',
state=20, project=self.p1, iteration = it)
us1.save()
t1 = Task(name='Task 1 for US A', user_story = us1, owner= self.user1)
t2 = Task(estimate=5, name='Task 2 for US A', user_story = us1, owner= self.user2)
t3 = Task(estimate=10, name='Task 1 for US A', user_story = us1)
for t in t1, t2, t3:
t.save()
tl1 = TaskLog(task=t1, summary="tasklog 1 for Task 1A", time_on_task=1, date=datetime.datetime.now(), owner=self.user1, iteration=it)
tl2 = TaskLog(task=t2, summary="tasklog 2 for Task 2A", time_on_task=2, date=datetime.datetime.now(),
owner=self.user1, iteration=it)
for tl in tl1, tl2:
tl.save()
self.assertEqual(it.estimated_without_owner, 10)
self.assertEqual(it.user_estimated(self.user1.id), 0)
self.assertEqual(it.user_progress(self.user1.id), 3)
self.assertEqual(it.user_estimated(self.user2.id), 5)
self.assertEqual(it.user_progress(self.user2.id), 0)
self.assertEqual(it.users_total_status,
[{'name':self.user1.username,'progress':3, 'estimated':0},
{'name':self.user2.username,'progress':0, 'estimated':5},
{'name':'no owner','progress':'', 'estimated':10},
]
)
示例2: test_complete_case
# 需要导入模块: from agilito.models import UserStory [as 别名]
# 或者: from agilito.models.UserStory import save [as 别名]
def test_complete_case(self):
it = Iteration(start_date=datetime.datetime.now(), end_date=datetime.datetime.now(), project=self.p1)
it.save()
us1 = UserStory(name='User story A',
planned=45, state=20, project=self.p1, iteration = it)
us2 = UserStory(name='User story B',
planned=30, state=30, project=self.p1, iteration = it)
us1.save()
us2.save()
t1 = Task(estimate=10, name='Task 1 for US A', user_story = us1, owner= self.user1)
t2 = Task(estimate=5, name='Task 2 for US A', user_story = us1, owner= self.user2)
t3 = Task(estimate=1, name='Task 1 for US B', user_story = us2, owner= self.user1)
t4 = Task(estimate=2, name='Task 2 for US B', user_story = us2, owner= self.user2)
t5 = Task(estimate=5, name='Task 2 for US B', user_story = us2)
t6 = Task(estimate=4, name='Task 2 for US B', user_story = us2)
for t in t1, t2, t3, t4, t5, t6:
t.save()
tl1 = TaskLog(task=t1, summary="tasklog 1 for Task 1A", time_on_task=1, date=datetime.datetime.now(), owner=self.user1, iteration=it)
tl2 = TaskLog(task=t2, summary="tasklog 2 for Task 2A", time_on_task=2, date=datetime.datetime.now(), owner=self.user1, iteration=it)
tl3 = TaskLog(task=t3, summary="tasklog 1 for Task 1B", time_on_task=3, date=datetime.datetime.now(), owner=self.user2, iteration=it)
tl4 = TaskLog(task=t4, summary="tasklog 2 for Task 2B", time_on_task=5, date=datetime.datetime.now(), owner=self.user2, iteration=it)
for tl in tl1, tl2, tl3, tl4:
tl.save()
self.assertEqual(it.estimated_without_owner, 9)
self.assertEqual(it.user_estimated(self.user1.id), 11)
self.assertEqual(it.user_estimated(self.user2.id), 7)
self.assertEqual(it.user_progress(self.user1.id), 3)
self.assertEqual(it.user_progress(self.user2.id), 8)
self.assertEqual(it.users_total_status,
[{'name':self.user1.username,'progress':3, 'estimated':11},
{'name':self.user2.username,'progress':8, 'estimated':7},
{'name':'no owner','progress':'', 'estimated':9},
]
)
示例3: TestUS49Base
# 需要导入模块: from agilito.models import UserStory [as 别名]
# 或者: from agilito.models.UserStory import save [as 别名]
class TestUS49Base(SeleniumBase):
def setUp(self):
self.user = User(username = 'User A')
self.passwd = 'hi'
self.user.set_password(self.passwd)
self.user.save()
self.project = Project(name = 'A Project')
self.project.save()
self.project.project_members.add(self.user)
self.project.save()
self.iteration = Iteration(start_date = '1990-01-01',
end_date = '2020-01-01',
project = self.project)
self.iteration.save()
self.story = UserStory(name = 'ABC', project = self.project,
description = 'a userstory about abc',
iteration = self.iteration, planned = 42, rank = 1,
state = 10, blocked = True)
self.story.save()
task_states = dict((v, k) for (k, v) in Task.STATES)
self.task_a = Task(name = "Task A", estimate = 8, remaining = 8,
state = task_states['In Progress'],
owner = self.user, user_story = self.story)
self.task_a.save()
self.task_b = Task(name = "Task B", estimate = 2, remaining = 2,
state = task_states['Defined'],
owner = self.user, user_story = self.story)
self.task_b.save()
super(TestUS49Base, self).setUp()
def tearDown(self):
self.project.delete()
self.user.delete()
super(TestUS49Base, self).tearDown()
示例4: metaWeblog_newPost
# 需要导入模块: from agilito.models import UserStory [as 别名]
# 或者: from agilito.models.UserStory import save [as 别名]
def metaWeblog_newPost(blogid, username, password, struct, publish):
user = authenticate(username, password)
projectID, category = blogid.split(':')
project = getProject(user, projectID)
story = UserStory()
story.project = project
story.name = struct['title']
story.description = struct['description']
story.save()
return str(story.id)
示例5: TestTaskForm
# 需要导入模块: from agilito.models import UserStory [as 别名]
# 或者: from agilito.models.UserStory import save [as 别名]
class TestTaskForm(test.TestCase):
fixtures = ['database_dump.json']
def setUp(self):
self.p1 = Project(name='Test Project 1')
self.p2 = Project(name='Test Project 2')
self.p1.save()
self.p2.save()
self.p1.project_members.add(User.objects.get(pk=1))
self.p2.project_members.add(User.objects.get(pk=2))
self.p2.project_members.add(User.objects.get(pk=3))
self.us1 = UserStory(name='User story A',
planned=45, state=20, project=self.p1)
self.us2 = UserStory(name='User story B',
planned=30, state=30, project=self.p2)
self.us1.save()
self.us2.save()
def tearDown(self):
for obj in self.us1, self.us2, self.p1, self.p2:
obj.delete()
def test_task_form_has_only_relevant_owners_simple(self):
form = TaskForm(project=self.p1)
owner_choices = list(form.fields['owner'].choices)
self.assertEqual(len(owner_choices), 2)
self.assertEqual(owner_choices[1][1], User.objects.get(pk=1).__str__())
def test_task_form_has_only_relevant_owners_w_instance_simple(self):
t1 = Task(name='Task 1 for US A', user_story = self.us1, owner=User.objects.get(pk=2))
form = TaskForm(project=self.p2, instance=t1)
owner_choices = list(form.fields['owner'].choices)
self.assertEqual(len(owner_choices), 3)
self.assertEqual(owner_choices[1][1], User.objects.get(pk=2).__str__())
self.assertEqual(owner_choices[2][1], User.objects.get(pk=3).__str__())
示例6: test_edit_change_us
# 需要导入模块: from agilito.models import UserStory [as 别名]
# 或者: from agilito.models.UserStory import save [as 别名]
def test_edit_change_us(self):
other_story = UserStory(name='DEF', project=self.project,
description='a userstory about def',
iteration=self.iteration, planned=42, rank=2,
state=20, blocked=False)
other_story.save()
test_case = TestCase(name='ABC Test', description='Test', priority=10,
user_story=self.story)
test_case.save()
pk = test_case.id
pre = TestCase.objects.count()
b = self.browser
b.click("link=Iteration")
b.wait()
b.click("link=ABC")
b.wait()
b.click("xpath=id('edit_testcase_%d')/a/img" % (test_case.id))
b.wait()
b.type("id_name", "hi")
b.type("id_description", "bye")
b.select("id_user_story", "US2: DEF")
self.assertEqual(b.get_selected_label("id_user_story"), "US2: DEF")
b.click("css=#content input[type=submit]")
for i in xrange(15):
b.wait()
self.assertEqual(TestCase.objects.count(), pre)
# reload test_case
test_case = TestCase.objects.get(pk=pk)
self.assertEqual(test_case.name, 'hi')
self.assertEqual(test_case.description, 'bye')
self.assertEqual(test_case.user_story.id, other_story.id)
test_case.delete()
other_story.delete()
示例7: TestUS21
# 需要导入模块: from agilito.models import UserStory [as 别名]
# 或者: from agilito.models.UserStory import save [as 别名]
class TestUS21(SeleniumBase):
def setUp(self):
self.passwd = 'hola' # random_name()
self.user = User(username=random_name())
self.user.set_password(self.passwd)
self.user.save()
self.proj1 = Project(name=random_name())
self.proj2 = Project(name=random_name())
for proj in self.proj1, self.proj2:
proj.save()
proj.project_members.add(self.user)
proj.save()
self.us1 = UserStory(name=random_name(), project=self.proj1)
self.us1.save()
self.us2 = UserStory(name=random_name(), project=self.proj2)
self.us2.save()
super(TestUS21, self).setUp()
def tearDown(self):
for obj in self.user, self.proj1, self.proj2, self.us1, self.us2:
obj.delete()
super(TestUS21, self).tearDown()
def test_user_assigned_to_multiple_projects_switch_to_other_project(self):
us_locator = "css=#user-story-list td.name a"
b = self.browser
b.click("link=Backlog")
b.wait()
this_us = b.get_text(us_locator)
if this_us == self.us1.name:
target_project, target_story = self.proj2, self.us2
else:
assert this_us == self.us2.name
target_project, target_story = self.proj1, self.us1
b.select("//li[@id='project-selection']/select",
"label=" + target_project.name)
b.wait()
self.assertEqual(b.get_text(us_locator), target_story.name)
示例8: test_parcial_case
# 需要导入模块: from agilito.models import UserStory [as 别名]
# 或者: from agilito.models.UserStory import save [as 别名]
def test_parcial_case(self):
it = Iteration(start_date=datetime.datetime.now(), end_date=datetime.datetime.now(), project=self.p1)
it.save()
us1 = UserStory(name='User story A',
planned=45, state=20, project=self.p1, iteration = it)
us2 = UserStory(name='User story B',
planned=30, state=30, project=self.p1, iteration = it)
us3 = UserStory(name='User story C',
planned=25, state=40, project=self.p1, iteration = it)
us1.save()
us2.save()
us3.save()
self.assertEqual(it.us_accepted_percentage, 25)
示例9: TestTestCaseEditForm
# 需要导入模块: from agilito.models import UserStory [as 别名]
# 或者: from agilito.models.UserStory import save [as 别名]
class TestTestCaseEditForm(test.TestCase):
fixtures = ['database_dump.json']
def setUp(self):
self.p1 = Project(name='Test Project 1')
self.p2 = Project(name='Test Project 2')
self.p1.save()
self.p2.save()
self.us1 = UserStory(name='User story A',
planned=45, state=20, project=self.p1)
self.us2 = UserStory(name='User story B',
planned=30, state=30, project=self.p2)
self.us3 = UserStory(name='User story C',
planned=30, state=30, project=self.p2)
self.us1.save()
self.us2.save()
self.us3.save()
self.tc1 = TestCase(user_story=self.us1, priority=10)
self.tc2 = TestCase(user_story=self.us2, priority=10)
self.tc1.save()
self.tc2.save()
def tearDown(self):
for obj in self.tc1, self.tc2, self.us1, self.us2, self.p1, self.p2:
obj.delete()
def test_test_case_edit_form_has_current_project_us_only(self):
form = TestCaseEditForm(project=self.tc1.user_story.project, instance=self.tc1)
user_story_choices = list(form.fields['user_story'].choices)
self.assertEqual(len(user_story_choices), 2)
self.assertEqual(user_story_choices[1][1], unicode(self.us1))
def test_test_case_edit_form_has_current_project_us_only_other(self):
form = TestCaseEditForm(project=self.tc2.user_story.project, instance=self.tc2)
user_story_choices = list(form.fields['user_story'].choices)
self.assertEqual(len(user_story_choices), 3)
self.assert_(unicode(self.us2) in set([user_story_choices[1][1], user_story_choices[2][1]]))
self.assert_(unicode(self.us3) in set([user_story_choices[1][1], user_story_choices[2][1]]))
示例10: TestBacklogAddUSDetailed
# 需要导入模块: from agilito.models import UserStory [as 别名]
# 或者: from agilito.models.UserStory import save [as 别名]
class TestBacklogAddUSDetailed(SeleniumBase):
def setUp(self):
self.user = User(username='User BBB')
self.passwd = 'hi'
self.user.set_password(self.passwd)
self.user.save()
self.project = Project(name='A Project BB')
self.project.save()
self.project.project_members.add(self.user)
self.project.save()
self.story1 = UserStory(name='User Story A', rank=3, planned=3, project=self.project)
self.story1.save()
self.story2 = UserStory(name='User Story B', rank=2, planned=8, project=self.project)
self.story2.save()
self.story3 = UserStory(name='User Story C', rank=1, planned=5, project=self.project)
self.story3.save()
super(TestBacklogAddUSDetailed, self).setUp()
def tearDown(self):
self.project.delete()
self.user.delete()
for x in self.story1, self.story2, self.story3:
x.delete()
super(TestBacklogAddUSDetailed, self).tearDown()
def test_create_complete_us(self):
self.login(username='User BBB', password='hi')
b = self.browser
b.click("link=Backlog")
b.wait()
b.click("create-detailed-user-story")
b.type("id_name", "A sample detailed user story")
b.type("id_description", "This is a detailed user story")
b.type("id_planned", "10")
b.type("id_rank", "50")
b.type("id_state", "10")
b.click("id_blocked")
b.click("us-create")
self.assertEqual(b.get_text("us-span-4"),
"A sample detailed user story")
示例11: TestBacklogQuickAdd
# 需要导入模块: from agilito.models import UserStory [as 别名]
# 或者: from agilito.models.UserStory import save [as 别名]
class TestBacklogQuickAdd(SeleniumBase):
def setUp(self):
self.user = User(username='User AB')
self.passwd = 'hi'
self.user.set_password(self.passwd)
self.user.save()
self.project = Project(name='A Project')
self.project.save()
self.project.project_members.add(self.user)
self.project.save()
self.story1 = UserStory(name='User Story A', rank=3, planned=3, project=self.project)
self.story1.save()
self.story2 = UserStory(name='User Story B', rank=2, planned=8, project=self.project)
self.story2.save()
self.story3 = UserStory(name='User Story C', rank=1, planned=5, project=self.project)
self.story3.save()
super(TestBacklogQuickAdd, self).setUp()
def tearDown(self):
self.project.delete()
self.user.delete()
for x in self.story1, self.story2, self.story3:
x.delete()
super(TestBacklogQuickAdd, self).tearDown()
def test_tc4(self):
self.login(username='User AB', password='hi')
#sel.open("/accounts/login/")
#sel.type("id_username", "User B")
#sel.type("id_password", "hi")
#sel.click("//input[@value='login']")
b = self.browser
b.click("link=Backlog")
b.wait()
b.click("create-user-story")
b.type("id_name", "A sample user story")
b.click("us-create")
self.assertEqual(b.get_text("us-span-4"),
"A sample user story")
示例12: TestTestResultForm
# 需要导入模块: from agilito.models import UserStory [as 别名]
# 或者: from agilito.models.UserStory import save [as 别名]
class TestTestResultForm(test.TestCase):
fixtures = ['database_dump.json']
def setUp(self):
self.p1 = Project(name='Test Project 1')
self.p2 = Project(name='Test Project 2')
self.p1.save()
self.p2.save()
self.p1.project_members.add(User.objects.get(pk=1))
self.p2.project_members.add(User.objects.get(pk=2))
self.p2.project_members.add(User.objects.get(pk=3))
self.us1 = UserStory(name='User story A',
planned=45, state=20, project=self.p1)
self.us2 = UserStory(name='User story B',
planned=30, state=30, project=self.p2)
self.us1.save()
self.us2.save()
self.tc1 = TestCase(user_story=self.us1, priority=10)
self.tc2 = TestCase(user_story=self.us2, priority=10)
self.tc3 = TestCase(user_story=self.us2, priority=10)
self.tc1.save()
self.tc2.save()
self.tc3.save()
def tearDown(self):
for obj in self.tc1, self.tc2, self.tc3, self.us1, self.us2, self.p1, self.p2:
obj.delete()
def test_test_result_form_only_test_cases_of_current_project_simple(self):
form = TestResultForm(project=self.p1)
test_case_choices = list(form.fields['test_case'].choices)
self.assertEqual(len(test_case_choices), 2)
self.assertEqual(test_case_choices[1][1], unicode(self.tc1))
tester_choices = list(form.fields['tester'].choices)
self.assertEqual(len(tester_choices), 2)
self.assertEqual(tester_choices[1][1], User.objects.get(pk=1).__str__())
def test_test_result_form_build_with_instance_has_only_test_cases_of_current_project(self):
test_result = TestResult(result=10, test_case=self.tc1, tester=User.objects.all()[0])
form = TestResultForm(project=self.p1,instance=test_result)
test_case_choices = list(form.fields['test_case'].choices)
self.assertEqual(len(test_case_choices), 2)
self.assertEqual(test_case_choices[1][1], unicode(self.tc1))
tester_choices = list(form.fields['tester'].choices)
self.assertEqual(len(tester_choices), 2)
self.assertEqual(tester_choices[1][1], User.objects.get(pk=1).__str__())
def test_test_result_form_only_test_cases_of_current_project_other(self):
form = TestResultForm(project=self.p2)
test_case_choices = list(form.fields['test_case'].choices)
self.assertEqual(len(test_case_choices), 3)
self.assert_(unicode(self.tc2) in set([test_case_choices[1][1], test_case_choices[2][1]]))
tester_choices = list(form.fields['tester'].choices)
self.assertEqual(len(tester_choices), 3)
self.assertEqual(tester_choices[1][1], User.objects.get(pk=2).__str__())
示例13: TestUS254
# 需要导入模块: from agilito.models import UserStory [as 别名]
# 或者: from agilito.models.UserStory import save [as 别名]
class TestUS254(TestUS49Base):
def setUp(self):
super(TestUS254, self).setUp()
self.user_story_states = dict((v,k) for (k,v) in UserStory.STATES)
self.story_2 = UserStory(name='TestUS254 A', project=self.project,
description='a userstory to test us254',
iteration=self.iteration, planned=42, rank=1,
state=10, blocked=False)
self.story_2.save()
self.story_3 = UserStory(name='TestUS254 B', project=self.project,
description='another userstory to test us254',
iteration=self.iteration, planned=42, rank=1,
state=10, blocked=False)
self.story_3.save()
self.story_4 = UserStory(name='TestUS254 C', project=self.project,
description='yet another userstory to test us254',
iteration=self.iteration, planned=42, rank=1,
state=10, blocked=False)
self.story_4.save()
self.story_5 = UserStory(name='TestUS254 D', project=self.project,
description='again, yet another userstory to test us254',
iteration=self.iteration, planned=42, rank=1,
state=10, blocked=False)
self.story_5.save()
self.task_states = dict((v,k) for (k,v) in Task.STATES)
# actuals > 0, not completed -> change state to In progress
self.task_c = Task(name="Task C", estimate=8, remaining=6,
state=self.task_states['Defined'],
owner=self.user, user_story=self.story_2)
self.task_c.save()
self.tasklog_c = TaskLog(task=self.task_c, time_on_task=2, summary='test',
date=datetime.today(), owner=self.user,
old_remaining=0)
self.tasklog_c.save()
# actuals > 0, completed, remaining > 0, all task in us completed ->
# should change US to complete and change task to complete, remaining 0
self.task_d = Task(name="Task D", estimate=2, remaining=2,
state=self.task_states['Complete'],
owner=self.user, user_story=self.story_3)
self.task_d.save()
self.task_f = Task(name="Task F", estimate=2, remaining=0,
state=self.task_states['Complete'],
owner=self.user, user_story=self.story_3)
self.task_f.save()
self.tasklog_f = TaskLog(task=self.task_f, time_on_task=2, summary='test',
date=datetime.today(), owner=self.user,
old_remaining=0)
self.tasklog_f.save()
self.tasklog_d = TaskLog(task=self.task_d, time_on_task=2, summary='test',
date=datetime.today(), owner=self.user,
old_remaining=0)
self.tasklog_d.save()
# actuals > 0, defined, remaining = 0, not all task in us completed
# should change to complete.
self.task_e = Task(name="Task E", estimate=2, remaining=0,
state=self.task_states['Defined'],
owner=self.user, user_story=self.story_2)
self.task_e.save()
self.tasklog_e = TaskLog(task=self.task_e, time_on_task=2, summary='test',
date=datetime.today(), owner=self.user,
old_remaining=0)
self.tasklog_e.save()
# actuals > 0, in progress, remaining = 0, not all task in us completed
# should change to complete.
self.task_g = Task(name="Task G", estimate=2, remaining=0,
state=self.task_states['In Progress'],
owner=self.user, user_story=self.story_2)
self.task_g.save()
self.tasklog_g = TaskLog(task=self.task_g, time_on_task=2, summary='test',
date=datetime.today(), owner=self.user,
old_remaining=0)
self.tasklog_g.save()
#.........这里部分代码省略.........