def setUpClass(cls): """ Project1: user1, user2, user3 Project2: user1, user2 Project3: user1, user3 """ super(SearchTestMixin, cls).setUpClass() cls.user1 = snippets.create_user() cls.user2 = snippets.create_user() cls.user3 = snippets.create_user() cls.project1 = snippets.create_project(cls.user1) cls.project2 = snippets.create_project(cls.user1) cls.project3 = snippets.create_project(cls.user1) cls.project1.add_user(cls.user2) cls.project1.add_user(cls.user3) cls.project2.add_user(cls.user2) cls.project3.add_user(cls.user3) cls.issue1 = Issue.create(cls.user1, "first issue", "whatever dude", cls.project1, assigned=cls.user1) cls.issue2 = Issue.create(cls.user1, "second issue", "lamb on the ground", cls.project1, assigned=cls.user2) cls.issue3 = Issue.create(cls.user1, "friendly hello", "hey there dude", cls.project2, assigned=cls.user1) cls.issue4 = Issue.create(cls.user1, "big problem", "pizza on the ground", cls.project2) search.refresh() # to ensure our stuff is going to be there when we search
def test_should_be_able_to_create_new_issue(self): """Should be able to create a new issue and get all related objects""" user = snippets.create_user() project = Project.create(name="test project", user=user) issue = Issue.create(user, name="test issue", description="Hey Jon, here's a bug for ya!", project=project)
def post(self): form = request.form project = Project.get(form['project']) assigned = form.get('assigned', None) if assigned: assigned = User.get(assigned) issue = Issue.create(session.user, form['name'], form['description'], project, assigned=assigned) return success(issue)