コード例 #1
0
ファイル: test_issue.py プロジェクト: ndreynolds/hopper
 def test_comment(self):
     issue = Issue(self.tracker)
     issue.save()
     c = Comment(issue)
     c.save()
     assert type(issue.comment(c.id)) is Comment
     assert issue.comment(c.id).fields == c.fields
コード例 #2
0
ファイル: test_issue.py プロジェクト: ndreynolds/hopper
 def test_comment(self):
     issue = Issue(self.tracker)
     issue.save()
     c = Comment(issue)
     c.save()
     assert type(issue.comment(c.id)) is Comment
     assert issue.comment(c.id).fields == c.fields
コード例 #3
0
ファイル: test_issue.py プロジェクト: ndreynolds/hopper
 def test_comments(self):
     issue = Issue(self.tracker)
     issue.save()
     # Make some comments
     comments = [Comment(issue) for i in range(20)]
     for c in comments:
         c.save()
     assert type(issue.comments()) is list
     assert len(issue.comments()) == 20
     assert len(issue.comments(n=15)) == 15
コード例 #4
0
ファイル: test_issue.py プロジェクト: ndreynolds/hopper
 def test_comments(self):
     issue = Issue(self.tracker)
     issue.save()
     # Make some comments
     comments = [Comment(issue) for i in range(20)]
     for c in comments:
         c.save()
     assert type(issue.comments()) is list
     assert len(issue.comments()) == 20
     assert len(issue.comments(n=15)) == 15
コード例 #5
0
ファイル: test_issue.py プロジェクト: ndreynolds/hopper
    def test_save(self):
        issue = Issue(self.tracker)
        issue.title = 'test title'
        issue.save()

        # Get the path to the issue and assert that it's there.
        path = self.tracker.get_issue_path(issue.id)
        assert os.path.exists(path)

        # Does the issue initialized from file match the original?
        issue_clone = Issue(self.tracker, issue.id)
        assert issue_clone.fields == issue.fields
コード例 #6
0
ファイル: test_issue.py プロジェクト: ndreynolds/hopper
    def test_save(self):
        issue = Issue(self.tracker)
        issue.title = "test title"
        issue.save()

        # Get the path to the issue and assert that it's there.
        path = self.tracker.get_issue_path(issue.id)
        assert os.path.exists(path)

        # Does the issue initialized from file match the original?
        issue_clone = Issue(self.tracker, issue.id)
        assert issue_clone.fields == issue.fields
コード例 #7
0
ファイル: test_database.py プロジェクト: ndreynolds/hopper
 def test_insert_many(self):
     '''Tests the `insert_many` method'''
     db = Database(self.env.tracker)
     issues = []
     for i in range(20):
         issue = Issue(self.env.tracker)
         issue.save()
         issues.append(issue)
     db.insert_many(issues)
     rows = db.select().execute()
     db_issues = [Issue(self.env.tracker, r['id']) for r in rows]
     # quick check to make sure they're all there.
     assert len(db_issues) == len(issues)
コード例 #8
0
 def test_insert(self):
     '''Tests the `insert` method'''
     db = Database(self.env.tracker)
     # make and insert the issue
     issue1 = Issue(self.env.tracker)
     issue1.content = 'test'
     issue1.title = 'Test'
     issue1.save()
     db.insert(issue1)
     rows = db.select().execute()
     issue2 = [Issue(self.env.tracker, r['id']) for r in rows][0]
     # make sure the issues are equal which triggers the __eq__ method.
     assert issue1 == issue2
コード例 #9
0
 def test_insert_many(self):
     '''Tests the `insert_many` method'''
     db = Database(self.env.tracker)
     issues = []
     for i in range(20):
         issue = Issue(self.env.tracker)
         issue.save()
         issues.append(issue)
     db.insert_many(issues)
     rows = db.select().execute()
     db_issues = [Issue(self.env.tracker, r['id']) for r in rows]
     # quick check to make sure they're all there.
     assert len(db_issues) == len(issues)
コード例 #10
0
ファイル: test_database.py プロジェクト: ndreynolds/hopper
 def test_insert(self):
     '''Tests the `insert` method'''
     db = Database(self.env.tracker)
     # make and insert the issue
     issue1 = Issue(self.env.tracker)
     issue1.content = 'test'
     issue1.title = 'Test'
     issue1.save()
     db.insert(issue1)
     rows = db.select().execute()
     issue2 = [Issue(self.env.tracker, r['id']) for r in rows][0]
     # make sure the issues are equal which triggers the __eq__ method.
     assert issue1 == issue2
コード例 #11
0
ファイル: cli.py プロジェクト: ndreynolds/hopper
def new(args):
    """Create a new issue."""
    t = args['tracker']
    i = Issue(t)
    config = UserConfig()
    # set the author info
    i.author['name'] = config.user['name']
    i.author['email'] = config.user['email']

    # no editor for inline calls
    if args['message'] is not None:
        i.title = args['message']
        i.content = '.'
    else:
        # get the user's editor
        editor = args['editor'] if args['editor'] else config.core['editor']
        # the Template object opens templates in the editor and parses them.
        template = IssueTemplate('new.hpr')
        path = template.open(editor)
        fields = template.parse(path)
        i.title = fields['title']
        i.content = fields['content']

    if i.save():
        # commit the changes
        if config.core['autocommit']:
            t.autocommit(message='Created a new issue %s' % i.id[:6],
                         author=config.user)
        print 'Created issue %s' % i.id[:6]
コード例 #12
0
def new():
    """Render the new issue view."""
    tracker, config = setup()
    header = 'Create a new issue'
    if request.method == 'POST':
        issue = Issue(tracker)
        issue.content = request.form['content']
        issue.title = request.form['title']
        labels = request.form['labels']
        if labels:
            issue.labels = labels.split(',')
        else:
            issue.labels = []
        issue.author['name'] = config.user['name']
        issue.author['email'] = config.user['email']
        if issue.save():
            tracker.autocommit(message='Created a new issue %s' % issue.id[:6], 
                               author=config.user)
            return redirect(url_for('issues.view', id=issue.id)) 
        else:
            flash('There was an error saving your issue.')
            return render_template('new.html', selected='issues', 
                                   header=header, tracker=tracker)
    else:
        return render_template('new.html', selected='issues', 
                               header=header, tracker=tracker)
コード例 #13
0
ファイル: test_tracker.py プロジェクト: ndreynolds/hopper
    def test_issue(self):
        t = Tracker.new(self.path)
        i1 = Issue(t)
        i1.save()
        i2 = t.issue(i1.id)
        # verify that issue() returns an Issue
        assert type(i2) is Issue
        # verify that the issues match
        assert i1.fields == i2.fields

        # invalid SHAs should raise BadReference
        invalid_sha = get_uuid()
        try:
            t.issue(invalid_sha)
        except BadReference:
            pass
コード例 #14
0
ファイル: cli.py プロジェクト: ndreynolds/hopper
def new(args):
    """Create a new issue."""
    t = args['tracker']
    i = Issue(t)
    config = UserConfig()
    # set the author info
    i.author['name'] = config.user['name']
    i.author['email'] = config.user['email']

    # no editor for inline calls
    if args['message'] is not None:
        i.title = args['message']
        i.content = '.'
    else:
        # get the user's editor
        editor = args['editor'] if args['editor'] else config.core['editor']
        # the Template object opens templates in the editor and parses them.
        template = IssueTemplate('new.hpr')
        path = template.open(editor)
        fields = template.parse(path)
        i.title = fields['title']
        i.content = fields['content']

    if i.save():
        # commit the changes
        if config.core['autocommit']:
            t.autocommit(message='Created a new issue %s' % i.id[:6],
                         author=config.user)
        print 'Created issue %s' % i.id[:6]
コード例 #15
0
ファイル: test_issue.py プロジェクト: ndreynolds/hopper
 def test_ne(self):
     issue1 = Issue(self.tracker)
     issue1.save()
     issue2 = Issue(self.tracker)
     issue2.save()
     assert issue1 != issue2
コード例 #16
0
ファイル: test_issue.py プロジェクト: ndreynolds/hopper
 def test_eq(self):
     issue1 = Issue(self.tracker)
     issue1.save()
     issue2 = Issue(self.tracker, issue1.id)
     assert issue1 == issue2
コード例 #17
0
ファイル: test_issue.py プロジェクト: ndreynolds/hopper
 def test_ne(self):
     issue1 = Issue(self.tracker)
     issue1.save()
     issue2 = Issue(self.tracker)
     issue2.save()
     assert issue1 != issue2
コード例 #18
0
ファイル: test_issue.py プロジェクト: ndreynolds/hopper
 def test_timestamps(self):
     issue = Issue(self.tracker)
     issue.title = 'test title'
     issue.save()
     assert issue.created == issue.updated
コード例 #19
0
ファイル: test_issue.py プロジェクト: ndreynolds/hopper
 def test_timestamps(self):
     issue = Issue(self.tracker)
     issue.title = "test title"
     issue.save()
     assert issue.created == issue.updated
コード例 #20
0
ファイル: test_issue.py プロジェクト: ndreynolds/hopper
 def test_eq(self):
     issue1 = Issue(self.tracker)
     issue1.save()
     issue2 = Issue(self.tracker, issue1.id)
     assert issue1 == issue2