Esempio n. 1
0
def test_ticket_not_first_arg():
    tmp = util.maketemp()
    storage.git_init(tmp)
    storage.init(tmp)
    with storage.Transaction(repo=tmp) as t:
        t.set(
            '29d7ae1a7d7cefd4c79d095ac0e47636aa02d4a5/description',
            'old',
            )
    result = util.clitest(
        args=[
            'edit',
            '29d7ae1a7d7cefd4c79d095ac0e47636aa02d4a5',
            ],
        stdin="""\
tags foo
ticket 29d7ae1a7d7cefd4c79d095ac0e47636aa02d4a5

Frobbing is borked

I ran frob and it was supposed to blarb, but it qwarked.
""",
        cwd=tmp,
        allow_stderr=True,
        exit_status=1,
        )
    result.check_stdout('')
    result.check_stderr("""\
bugit edit: updating ticket 29d7ae1a7d7cefd4c79d095ac0e47636aa02d4a5 ...
bugit edit: ticket header not on first line
""")
    def list_tickets():
        # TODO share me
        for (mode, type_, object, basename) in storage.git_ls_tree(
            path='',
            repo=tmp,
            children=True,
            ):
            yield basename
    got = list(list_tickets())
    eq(got, ['29d7ae1a7d7cefd4c79d095ac0e47636aa02d4a5'])
    got = sorted(storage.ls(
            path='29d7ae1a7d7cefd4c79d095ac0e47636aa02d4a5',
            repo=tmp,
            ))
    eq(
        got,
        sorted([
                'description',
                #TODO 'tags/reporter:TODO'
                ]),
        )
    got = storage.get(
        path=os.path.join(
            '29d7ae1a7d7cefd4c79d095ac0e47636aa02d4a5',
            'description',
            ),
        repo=tmp,
        )
    eq(got, 'old')
Esempio n. 2
0
def test_variable_short():
    tmp = util.maketemp()
    storage.git_init(tmp)
    storage.init(tmp)
    with storage.Transaction(repo=tmp) as t:
        t.set(
            'd239371f3b6b61ca1076bb460e331b3edb412970/description',
            """\
Oncolator segfaults on some inputs
""",
            )
        t.set(
            'd239371f3b6b61ca1076bb460e331b3edb412970/answer',
            "42\n",
            )
    result = util.clitest(
        args=[
            'show',
            'd239',
            ],
        cwd=tmp,
        )
    result.check_stdout("""\
ticket d239371f3b6b61ca1076bb460e331b3edb412970

Oncolator segfaults on some inputs

--
answer=42
""")
Esempio n. 3
0
def test_transaction_set_simple():
    tmp = util.maketemp()
    storage.git_init(tmp)
    storage.init(tmp)
    orig_head = storage.git_rev_parse(
        rev='bugit/HEAD',
        repo=tmp,
        )
    with storage.Transaction(repo=tmp) as t:
        t.set(
            'f3da69cd9eca7a69ed72a4edf2d65c84e83b0411/xyzzy',
            'mockdata\n',
            )
    got = storage.get(
        path='f3da69cd9eca7a69ed72a4edf2d65c84e83b0411/xyzzy',
        repo=tmp,
        )
    eq(got, 'mockdata\n')
    parent = storage.git_rev_parse(
        rev='bugit/HEAD^1',
        repo=tmp,
        )
    eq(orig_head, parent)
    merge = storage.git_rev_parse(
        rev='bugit/HEAD^2',
        repo=tmp,
        )
    eq(merge, None)
Esempio n. 4
0
def test_minimal_with_number():
    tmp = util.maketemp()
    storage.git_init(tmp)
    storage.init(tmp)
    with storage.Transaction(repo=tmp) as t:
        t.set(
            'd239371f3b6b61ca1076bb460e331b3edb412970/number',
            '3431\n',
            )
        t.set(
            'd239371f3b6b61ca1076bb460e331b3edb412970/description',
            """\
Oncolator segfaults on some inputs
""",
            )
    result = util.clitest(
        args=[
            'show',
            '#3431',
            ],
        cwd=tmp,
        )
    result.check_stdout("""\
ticket d239371f3b6b61ca1076bb460e331b3edb412970
number #3431

Oncolator segfaults on some inputs

--
""")
Esempio n. 5
0
def test_simple_stdin_ticketAsArg():
    tmp = util.maketemp()
    storage.git_init(tmp)
    storage.init(tmp)
    with storage.Transaction(repo=tmp) as t:
        t.set(
            '29d7ae1a7d7cefd4c79d095ac0e47636aa02d4a5/description',
            'old',
            )
    TICKET = '29d7ae1a7d7cefd4c79d095ac0e47636aa02d4a5'
    result = util.clitest(
        args=[
            'edit',
            TICKET,
            ],
        stdin="""\
nop

Frobbing is borked

I ran frob and it was supposed to blarb, but it qwarked.
""",
        cwd=tmp,
        allow_stderr=True,
        )
    result.check_stdout('')
    result.check_stderr("""\
bugit edit: updating ticket %s ...
bugit edit: saved
""" % TICKET)
    def list_tickets():
        # TODO share me
        for (mode, type_, object, basename) in storage.git_ls_tree(
            path='',
            repo=tmp,
            children=True,
            ):
            yield basename
    got = list(list_tickets())
    eq(got, [TICKET])
    got = sorted(storage.ls(
            path=TICKET,
            repo=tmp,
            ))
    eq(
        got,
        sorted([
                'description',
                #TODO 'tags/reporter:TODO'
                ]),
        )
    got = storage.get(
        path=os.path.join(TICKET, 'description'),
        repo=tmp,
        )
    eq(got, """\
Frobbing is borked

I ran frob and it was supposed to blarb, but it qwarked.
""")
Esempio n. 6
0
def test_transaction_abort():
    tmp = util.maketemp()
    storage.git_init(tmp)
    storage.init(tmp)
    with storage.Transaction(repo=tmp) as t:
        t.set(
            'f3da69cd9eca7a69ed72a4edf2d65c84e83b0411/xyzzy',
            'mockdata\n',
            )
    class MyException(Exception):
        pass
    try:
        with storage.Transaction(repo=tmp) as t:
            t.set(
                'f3da69cd9eca7a69ed72a4edf2d65c84e83b0411/xyzzy',
                'newvalue\n',
                )
            raise MyException()
    except MyException:
        pass
    else:
        raise RuntimeError('Expected MyException')
    got = storage.get(
        path='f3da69cd9eca7a69ed72a4edf2d65c84e83b0411/xyzzy',
        repo=tmp,
        )
    eq(got, 'mockdata\n')
Esempio n. 7
0
def test_editor_noop():
    tmp = util.maketemp()
    storage.git_init(tmp)
    storage.init(tmp)
    orig_head = storage.git_rev_parse(rev="bugit/HEAD", repo=tmp)

    class FakeTTYFileDescription(object):
        def isatty(self):
            return True

    FAKE_EDITOR = os.path.join(os.path.dirname(__file__), "editor-that-does-nothing")

    result = util.clitest(
        args=["new"], environ=dict(BUGIT_EDITOR=FAKE_EDITOR), stdin=FakeTTYFileDescription(), allow_stderr=True, cwd=tmp
    )
    result.check_stdout("")
    result.check_stderr(
        re.compile(
            r"""
^
bugit\ new:\ creating\ ticket\ ([0-9a-f]{40})\ \.\.\.\n
bugit\ new:\ file\ was\ not\ changed,\ discarding\n
$
""",
            re.VERBOSE,
        )
    )
    new_head = storage.git_rev_parse(rev="bugit/HEAD", repo=tmp)
    eq(orig_head, new_head)
Esempio n. 8
0
def test_rm_simple():
    tmp = util.maketemp()
    storage.git_init(tmp)
    storage.init(tmp)
    with storage.Transaction(repo=tmp) as t:
        t.set(
            'f3da69cd9eca7a69ed72a4edf2d65c84e83b0411/xyzzy',
            'mockdata\n',
            )
        t.set(
            'f3da69cd9eca7a69ed72a4edf2d65c84e83b0411/quux',
            'mock2\n',
            )
        t.set(
            '5d6d80d51c73ea24e47f2de6f207b9de5479b6b2/quux',
            'distraction\n',
            )
    got = storage.ls(
        path='f3da69cd9eca7a69ed72a4edf2d65c84e83b0411',
        repo=tmp,
        )
    got = sorted(got)
    eq(got, sorted(['xyzzy', 'quux']))
    with storage.Transaction(repo=tmp) as t:
        t.rm('f3da69cd9eca7a69ed72a4edf2d65c84e83b0411/quux')
    got = storage.ls(
        path='f3da69cd9eca7a69ed72a4edf2d65c84e83b0411',
        repo=tmp,
        )
    got = list(got)
    eq(got, ['xyzzy'])
Esempio n. 9
0
def test_lookup_name():
    tmp = util.maketemp()
    storage.git_init(tmp)
    storage.init(tmp)
    with storage.Transaction(repo=tmp) as t:
        t.set(
            'd239371f3b6b61ca1076bb460e331b3edb412970/description',
            """\
Oncolator segfaults on some inputs
""",
            )
        t.set(
            'd239371f3b6b61ca1076bb460e331b3edb412970/name/oncolator-segfault',
            '',
            )
    result = util.clitest(
        args=[
            'show',
            'oncolator-segfault',
            ],
        cwd=tmp,
        )
    result.check_stdout("""\
ticket d239371f3b6b61ca1076bb460e331b3edb412970
name oncolator-segfault

Oncolator segfaults on some inputs

--
""")
Esempio n. 10
0
def test_unknown_ticket_arg():
    tmp = util.maketemp()
    storage.git_init(tmp)
    storage.init(tmp)
    result = util.clitest(
        args=[
            'edit',
            '29d7ae1a7d7cefd4c79d095ac0e47636aa02d4a5',
            ],
        stdin="""\
nop

Frobbing is borked
""",
        cwd=tmp,
        allow_stderr=True,
        exit_status=1,
        )
    result.check_stdout('')
    result.check_stderr("""\
bugit edit: Ticket not found: 29d7ae1a7d7cefd4c79d095ac0e47636aa02d4a5
""")
    def list_tickets():
        # TODO share me
        for (mode, type_, object, basename) in storage.git_ls_tree(
            path='',
            repo=tmp,
            children=True,
            ):
            yield basename
    got = list(list_tickets())
    eq(got, [])
Esempio n. 11
0
def test_ambiguous():
    tmp = util.maketemp()
    storage.git_init(tmp)
    storage.init(tmp)
    with storage.Transaction(repo=tmp) as t:
        t.set(
            'd239371f3b6b61ca1076bb460e331b3edb412970/description',
            """\
Foo
""",
            )
        t.set(
            'd23959133fdca3611368d192bf6de4157a54d7a5/description',
            """\
Bar
""",
            )
    result = util.clitest(
        args=[
            'show',
            'd239'
            ],
        cwd=tmp,
        exit_status=1,
        allow_stderr=True,
        )
    result.check_stdout('')
    result.check_stderr("""\
bugit: Matches more than one ticket: d239
""")
Esempio n. 12
0
def test_no_match():
    tmp = util.maketemp()
    storage.git_init(tmp)
    storage.init(tmp)
    with storage.Transaction(repo=tmp) as t:
        t.set(
            'f3da69cd9eca7a69ed72a4edf2d65c84e83b0411/number',
            '3431\n',
            )
        t.set(
            'f3da69cd9eca7a69ed72a4edf2d65c84e83b0411/description',
            'I am not a xyzzy bug\n',
            )
        t.set(
            'f3da69cd9eca7a69ed72a4edf2d65c84e83b0411/tags/quux',
            '',
            )
    result = util.clitest(
        args=[
            'list',
            '--tag=xyzzy',
            ],
        cwd=tmp,
        )
    result.check_stdout('')
Esempio n. 13
0
def test_init_repeat():
    tmp = util.maketemp()
    storage.git_init(tmp)
    storage.init(tmp)
    util.check_bugit_repository(repo=tmp)
    storage.init(tmp)
    util.check_bugit_repository(repo=tmp)
Esempio n. 14
0
def test_no_tags():
    tmp = util.maketemp()
    storage.git_init(tmp)
    storage.init(tmp)
    with storage.Transaction(repo=tmp) as t:
        t.set(
            'f3da69cd9eca7a69ed72a4edf2d65c84e83b0411/description',
            """\
Oncolator segfaults on some inputs

The Oncolator service segfaults if I go to the web page,
login, choose quick oncolation from the radio buttons and
click the "Onc!" button.

I need to demo this to the Board of Directors on Monday, need a
fix quick! It crashed on me today around 9:20 am, you should be
able to find it in the server logs.
""",
            )
    result = util.clitest(
        args=[
            'list',
            ],
        cwd=tmp,
        )
    # with no number or name, default to 7-digit prefix of ticket,
    # similar to git rev-parse --short
    result.check_stdout("""\
f3da69c\tOncolator segfaults on some inputs
""")
Esempio n. 15
0
def test_description_whitespace():
    # not really sure how you could end up without a description, but
    # let's not totally fail
    tmp = util.maketemp()
    storage.git_init(tmp)
    storage.init(tmp)
    with storage.Transaction(repo=tmp) as t:
        t.set(
            'd239371f3b6b61ca1076bb460e331b3edb412970/description',
            '\n',
            )
        t.set(
            'd239371f3b6b61ca1076bb460e331b3edb412970/number',
            '3431\n',
            )
    result = util.clitest(
        args=[
            'show',
            'd239',
            ],
        cwd=tmp,
        )
    result.check_stdout("""\
ticket d239371f3b6b61ca1076bb460e331b3edb412970
number #3431

--
""")
Esempio n. 16
0
def test_header():
    tmp = util.maketemp()
    storage.git_init(tmp)
    storage.init(tmp)
    result = util.clitest(
        args=["new"],
        stdin="""\
tags qwark

Frobbing is borked

I ran frob and it was supposed to blarb, but it qwarked.
""",
        cwd=tmp,
        allow_stderr=True,
    )
    result.check_stdout("")
    m = result.check_stderr(
        re.compile(
            r"""
^
bugit\ new:\ creating\ ticket\ ([0-9a-f]{40})\ \.\.\.\n
bugit\ new:\ saved\n
$
""",
            re.VERBOSE,
        )
    )
    ticket = m.group(1)

    def list_tickets():
        # TODO share me
        for (mode, type_, object, basename) in storage.git_ls_tree(path="", repo=tmp, children=True):
            yield basename

    got = list(list_tickets())
    eq(got, [ticket])
    got = sorted(storage.ls(path=ticket, repo=tmp))
    eq(
        got,
        sorted(
            [
                "description",
                # TODO 'tags/reporter:TODO'
                "tags/qwark",
            ]
        ),
    )
    got = storage.get(path=os.path.join(ticket, "description"), repo=tmp)
    eq(
        got,
        """\
Frobbing is borked

I ran frob and it was supposed to blarb, but it qwarked.
""",
    )
    got = storage.get(path=os.path.join(ticket, "tags/qwark"), repo=tmp)
    eq(got, "")
Esempio n. 17
0
def test_editor_simple():
    tmp = util.maketemp()
    storage.git_init(tmp)
    storage.init(tmp)

    class FakeTTYFileDescription(object):
        def isatty(self):
            return True

    FAKE_EDITOR = os.path.join(os.path.dirname(__file__), "editor-append")

    result = util.clitest(
        args=["new"], environ=dict(BUGIT_EDITOR=FAKE_EDITOR), stdin=FakeTTYFileDescription(), allow_stderr=True, cwd=tmp
    )
    result.check_stdout("")
    m = result.check_stderr(
        re.compile(
            r"""
^
bugit\ new:\ creating\ ticket\ ([0-9a-f]{40})\ \.\.\.\n
bugit\ new:\ saved\n
$
""",
            re.VERBOSE,
        )
    )
    ticket = m.group(1)

    def list_tickets():
        # TODO share me
        for (mode, type_, object, basename) in storage.git_ls_tree(path="", repo=tmp, children=True):
            yield basename

    got = list(list_tickets())
    eq(got, [ticket])
    got = sorted(storage.ls(path=ticket, repo=tmp))
    eq(
        got,
        sorted(
            [
                "description",
                # TODO 'tags/reporter:TODO'
            ]
        ),
    )
    got = storage.get(path=os.path.join(ticket, "description"), repo=tmp)
    eq(
        got,
        """\
Enter description here, with a short first paragraph.

Separate variables from main description with "--".
Kilroy was here
""",
    )
Esempio n. 18
0
def test_empty():
    tmp = util.maketemp()
    storage.git_init(tmp)
    storage.init(tmp)
    result = util.clitest(
        args=[
            'list',
            ],
        cwd=tmp,
        )
    result.check_stdout('')
Esempio n. 19
0
def test_tag_wrap():
    tmp = util.maketemp()
    storage.git_init(tmp)
    storage.init(tmp)
    with storage.Transaction(repo=tmp) as t:
        t.set(
            'f3da69cd9eca7a69ed72a4edf2d65c84e83b0411/number',
            '3431\n',
            )
        t.set(
            'f3da69cd9eca7a69ed72a4edf2d65c84e83b0411/description',
            """\
Oncolator segfaults on some inputs

The Oncolator service segfaults if I go to the web page,
login, choose quick oncolation from the radio buttons and
click the "Onc!" button.

I need to demo this to the Board of Directors on Monday, need a
fix quick! It crashed on me today around 9:20 am, you should be
able to find it in the server logs.
""",
            )
        t.set(
            'f3da69cd9eca7a69ed72a4edf2d65c84e83b0411/tags/priority:high',
            '',
            )
        t.set(
            'f3da69cd9eca7a69ed72a4edf2d65c84e83b0411/tags/denial-of-service',
            '',
            )
        t.set(
            'f3da69cd9eca7a69ed72a4edf2d65c84e83b0411/tags/security',
            '',
            )
        t.set(
            'f3da69cd9eca7a69ed72a4edf2d65c84e83b0411/tags/lots-of-long-tickets',
            '',
            )
        t.set(
            'f3da69cd9eca7a69ed72a4edf2d65c84e83b0411/tags/blah-blah-blah',
            '',
            )
    result = util.clitest(
        args=[
            'list',
            ],
        cwd=tmp,
        )
    result.check_stdout("""\
#3431\tOncolator segfaults on some inputs
  priority:high blah-blah-blah denial-of-service lots-of-long-tickets
  security
""")
Esempio n. 20
0
def test_simple():
    tmp = util.maketemp()
    storage.git_init(tmp)
    result = util.clitest(
        args=[
            'init',
            ],
        cwd=tmp,
        )
    result.check_stdout('')
    util.check_bugit_repository(repo=tmp)
Esempio n. 21
0
def test_transaction_get_simple():
    tmp = util.maketemp()
    storage.git_init(tmp)
    storage.init(tmp)
    with storage.Transaction(repo=tmp) as t:
        t.set(
            'f3da69cd9eca7a69ed72a4edf2d65c84e83b0411/xyzzy',
            'mockdata\n',
            )
    with storage.Snapshot(repo=tmp) as s:
        got = s.get(
            path='f3da69cd9eca7a69ed72a4edf2d65c84e83b0411/xyzzy',
            )
        eq(got, 'mockdata\n')
Esempio n. 22
0
def test_not_found_number():
    tmp = util.maketemp()
    storage.git_init(tmp)
    storage.init(tmp)
    result = util.clitest(
        args=[
            'show',
            '#11'
            ],
        cwd=tmp,
        exit_status=1,
        allow_stderr=True,
        )
    result.check_stdout('')
    result.check_stderr("""\
bugit: Ticket not found: #11
""")
Esempio n. 23
0
def test_variable_long():
    tmp = util.maketemp()
    storage.git_init(tmp)
    storage.init(tmp)
    with storage.Transaction(repo=tmp) as t:
        t.set(
            'd239371f3b6b61ca1076bb460e331b3edb412970/description',
            """\
Oncolator segfaults on some inputs
""",
            )
        t.set(
            'd239371f3b6b61ca1076bb460e331b3edb412970/ashortone',
            # just short enough not to wrap
            ((70 - len('something=')) * 'x') + '\n',
            )
        t.set(
            'd239371f3b6b61ca1076bb460e331b3edb412970/longerone',
            # just one too long
            ((71 - len('longerone=')) * 'x') + '\n',
            )
        t.set(
            'd239371f3b6b61ca1076bb460e331b3edb412970/toolong',
            50*'foo ',
            )
    result = util.clitest(
        args=[
            'show',
            'd239',
            ],
        cwd=tmp,
        )
    result.check_stdout("""\
ticket d239371f3b6b61ca1076bb460e331b3edb412970

Oncolator segfaults on some inputs

--
ashortone=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
longerone=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
toolong=foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo
\tfoo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo
\tfoo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo
\tfoo
""")
Esempio n. 24
0
def test_bad_no_default_ticket():
    tmp = util.maketemp()
    storage.git_init(tmp)
    storage.init(tmp)
    result = util.clitest(
        args=[
            'show',
            ],
        cwd=tmp,
        exit_status=2,
        allow_stderr=True,
        )
    result.check_stdout('')
    result.check_stderr("""\
Usage: bugit show [OPTS] [TICKET]

bugit: error: no default ticket set
""")
Esempio n. 25
0
def test_help():
    tmp = util.maketemp()
    storage.git_init(tmp)
    storage.init(tmp)
    result = util.clitest(
        args=[
            'show',
            '--help',
            ],
        cwd=tmp,
        )
    result.check_stdout("""\
Usage: bugit show [OPTS] [TICKET]

Options:
  -h, --help       show this help message and exit
  -v, --verbose    show more information
  --format=FORMAT  show output in this format
""")
Esempio n. 26
0
def test_variable_multiline():
    tmp = util.maketemp()
    storage.git_init(tmp)
    storage.init(tmp)
    with storage.Transaction(repo=tmp) as t:
        t.set(
            'd239371f3b6b61ca1076bb460e331b3edb412970/description',
            """\
Oncolator segfaults on some inputs
""",
            )
        t.set(
            'd239371f3b6b61ca1076bb460e331b3edb412970/multiline',
            """\
I consist of
multiple lines
and my formatting
is precious and
dear to author
"""
            )
    result = util.clitest(
        args=[
            'show',
            'd239',
            ],
        cwd=tmp,
        )
    result.check_stdout("""\
ticket d239371f3b6b61ca1076bb460e331b3edb412970

Oncolator segfaults on some inputs

--
multiline=
\tI consist of
\tmultiple lines
\tand my formatting
\tis precious and
\tdear to author
""")
Esempio n. 27
0
def test_header_bad_ticket():
    # can't include ticket sha for "bugit new"
    tmp = util.maketemp()
    storage.git_init(tmp)
    storage.init(tmp)
    result = util.clitest(
        args=["new"],
        stdin="""\
ticket 29d7ae1a7d7cefd4c79d095ac0e47636aa02d4a5
tags qwark

Frobbing is borked

I ran frob and it was supposed to blarb, but it qwarked.
""",
        cwd=tmp,
        allow_stderr=True,
        exit_status=1,
    )
    result.check_stdout("")
    m = result.check_stderr(
        re.compile(
            r"""
^
bugit\ new:\ creating\ ticket\ ([0-9a-f]{40})\ \.\.\.\n
bugit\ new:\ cannot\ include\ ticket\ identity\ when\ creating\ ticket\n
$
""",
            re.VERBOSE,
        )
    )
    ticket = m.group(1)

    def list_tickets():
        # TODO share me
        for (mode, type_, object, basename) in storage.git_ls_tree(path="", repo=tmp, children=True):
            yield basename

    got = list(list_tickets())
    eq(got, [])
Esempio n. 28
0
def test_multiple():
    tmp = util.maketemp()
    storage.git_init(tmp)
    storage.init(tmp)
    with storage.Transaction(repo=tmp) as t:
        t.set(
            'd239371f3b6b61ca1076bb460e331b3edb412970/description',
            """\
Oncolator segfaults on some inputs
""",
            )
        t.set(
            'b6de831319bcac7de17dbd85432792daae5925dc/description',
            """\
Frob is kabork.
""",
            )
    result = util.clitest(
        args=[
            'show',
            'd239',
            'b6de831319bca',
            ],
        cwd=tmp,
        )
    result.check_stdout("""\
ticket d239371f3b6b61ca1076bb460e331b3edb412970

Oncolator segfaults on some inputs

--
---
ticket b6de831319bcac7de17dbd85432792daae5925dc

Frob is kabork.

--
""")
Esempio n. 29
0
def test_simple():
    tmp = util.maketemp()
    storage.git_init(tmp)
    storage.init(tmp)
    with storage.Transaction(repo=tmp) as t:
        t.set(
            'd239371f3b6b61ca1076bb460e331b3edb412970/number',
            '3431\n',
            )
        t.set(
            'd239371f3b6b61ca1076bb460e331b3edb412970/tags/priority:high',
            '',
            )
        t.set(
            'd239371f3b6b61ca1076bb460e331b3edb412970/tags/denial-of-service',
            '',
            )
        t.set(
            'd239371f3b6b61ca1076bb460e331b3edb412970/tags/security',
            '',
            )
        t.set(
            'd239371f3b6b61ca1076bb460e331b3edb412970/tags/reporter:[email protected]',
            '',
            )
        t.set(
            'd239371f3b6b61ca1076bb460e331b3edb412970/description',
            """\
Oncolator segfaults on some inputs

The Oncolator service segfaults if I go to the web page,
login, choose quick oncolation from the radio buttons and
click the "Onc!" button.

I need to demo this to the Board of Directors on Monday, need a
fix quick! It crashed on me today around 9:20 am, you should be
able to find it in the server logs.
""",
            )
        t.set(
            'd239371f3b6b61ca1076bb460e331b3edb412970/browser',
            "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.6) Gecko/20061201 Firefox/2.0.0.6 (Ubuntu-feisty)",
            )
        t.set(
            'd239371f3b6b61ca1076bb460e331b3edb412970/seen/c26ce22b9cf7f95f23c9efc461422d8bfe386628',
            '',
            )
        t.set(
            'd239371f3b6b61ca1076bb460e331b3edb412970/seen/6f5613979900ee198042f6c3eb922d750bbfaa49',
            '',
            )
        t.set(
            'd239371f3b6b61ca1076bb460e331b3edb412970/not-seen/7d330ee77f44d4e9106d7ab5161e2e58b0c33bf6',
            '',
            )
    result = util.clitest(
        args=[
            'show',
            '#3431',
            ],
        cwd=tmp,
        )
    result.check_stdout("""\
ticket d239371f3b6b61ca1076bb460e331b3edb412970
number #3431
tags priority:high denial-of-service security
     reporter:[email protected]
seen 6f5613979900ee198042f6c3eb922d750bbfaa49
     c26ce22b9cf7f95f23c9efc461422d8bfe386628
not-seen 7d330ee77f44d4e9106d7ab5161e2e58b0c33bf6

Oncolator segfaults on some inputs

The Oncolator service segfaults if I go to the web page,
login, choose quick oncolation from the radio buttons and
click the "Onc!" button.

I need to demo this to the Board of Directors on Monday, need a
fix quick! It crashed on me today around 9:20 am, you should be
able to find it in the server logs.

--
browser=Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.6)
\tGecko/20061201 Firefox/2.0.0.6 (Ubuntu-feisty)
""")
Esempio n. 30
0
def test_transaction_nop():
    tmp = util.maketemp()
    storage.git_init(tmp)
    storage.init(tmp)
    with storage.Transaction(repo=tmp) as t:
        pass