def test_attachments_file_attachment(self): fields = {"title": "title", "description": "desc", "reason": "reason", "test": "test", "status": 1} s = models.story.create_story(self.__project, fields) self.assertEqual(1, self.__project.story_set.count()) models.story_attachment.create(s.id, SimpleUploadedFile('test_it.txt', 'This is some text to add to the file')) attach = story_attachment.get_attachments_for_story(s) self.assertIsNotNone(attach, "File attachment should exist") for a in story_attachment.get_all_attachments(): story_attachment.delete(a.uuid)
def issues(request, projectID): # Loads the IssueList template, which contains a list of the issues the user is associated with, within a project p = project_api.get_project(projectID) if p is None: return redirect('/requirements/projects') iterations = mdl_iteration.get_iterations_for_project(p) association = UserAssociation.objects.get(user=request.user, project=p) context = { 'projects': project_api.get_projects_for_user(request.user.id), 'project': p, 'stories': mdl_story.get_stories_for_project(p), 'tasks': mdl_task.get_all_tasks(), 'comments': mdl_story_comment.get_all_comments(), 'attachments': mdl_story_attachment.get_all_attachments(), 'issues': mdl_issue.get_all_issues(), 'iterations': iterations, 'association': association, 'canOwnProject': request.user.has_perm(PERMISSION_OWN_PROJECT), } return render(request, 'IssueList.html', context)
def project(request, projectID): p = project_api.get_project(projectID) if p is None: return redirect('/requirements/projects') iterations = mdl_iteration.get_iterations_for_project(p) association = UserAssociation.objects.get(user=request.user, project=p) priorities = Story.PRIORITY_CHOICES context = { 'projects': project_api.get_projects_for_user(request.user.id), 'project': p, 'stories': mdl_story.get_stories_for_project(p), 'tasks': mdl_task.get_all_tasks(), 'comments': mdl_story_comment.get_all_comments(), 'priorities': priorities, 'attachments': mdl_story_attachment.get_all_attachments(), 'issues': mdl_issue.get_all_issues(), 'iterations': iterations, 'association': association, 'canOwnProject': request.user.has_perm(PERMISSION_OWN_PROJECT), } return render(request, 'ProjectDetail.html', context)
def project(request, projectID): project = project_api.get_project(projectID) if project is None: return redirect('/req/projects') iterations = mdl_iteration.get_iterations_for_project(project) association = UserAssociation.objects.get( user=request.user, project=project) priorities = Story.PRIORITY_CHOICES context = {'projects': project_api.get_projects_for_user(request.user.id), 'project': project, 'stories': mdl_story.get_stories_for_project(project), 'tasks': mdl_task.get_all_tasks(), 'comments': mdl_story_comment.get_all_comments(), 'priorities': priorities, 'attachments': mdl_story_attachment.get_all_attachments(), 'issues': mdl_issue.get_all_issues(), 'iterations': iterations, 'association': association, 'canOwnProject': request.user.has_perm(PERMISSION_OWN_PROJECT), } return render(request, 'ProjectDetail.html', context)
def issues(request, projectID): # Loads the IssueList template, which contains a list of the issues the user is # associated with, within a project project = project_api.get_project(projectID) if project is None: return redirect('/req/projects') iterations = mdl_iteration.get_iterations_for_project(project) association = UserAssociation.objects.get( user=request.user, project=project) context = {'projects': project_api.get_projects_for_user(request.user.id), 'project': project, 'stories': mdl_story.get_stories_for_project(project), 'tasks': mdl_task.get_all_tasks(), 'comments': mdl_story_comment.get_all_comments(), 'attachments': mdl_story_attachment.get_all_attachments(), 'issues': mdl_issue.get_all_issues(), 'iterations': iterations, 'association': association, 'canOwnProject': request.user.has_perm(PERMISSION_OWN_PROJECT), } return render(request, 'IssueList.html', context)
def test_attachments_get_all_attachments(self): attach = story_attachment.get_all_attachments() self.assertEqual(0, attach.count())