Exemplo n.º 1
0
def test_get_update_status_ghargs_other():
    card = {'note': 'Just some text', 'column_name': 'in_progress'}
    cards = CardDB(card, index='note')

    with open(os.path.join(PWD,
                           'payload_examples/card_created_other.json')) as f:
        payload = json.load(f)
    event = sansio.Event(payload, event="project_card", delivery_id="12345")

    assert get_update_status_ghargs(event, database=cards) is None
Exemplo n.º 2
0
def test_get_update_status_ghargs_not_found():
    cards = CardDB(index='note')

    with open(os.path.join(PWD,
                           'payload_examples/card_moved_to_done.json')) as f:
        payload = json.load(f)
    event = sansio.Event(payload, event="project_card", delivery_id="12345")

    ghargs = GHArgs(
        'https://api.github.com/repos/NCAR/xdev-bot-testing/issues/75',
        data={'state': 'closed'},
        func='patch')
    assert get_update_status_ghargs(event, database=cards) == ghargs
Exemplo n.º 3
0
def test_get_update_status_ghargs_no_change():
    card = {
        'note': 'https://github.com/NCAR/xdev-bot-testing/pull/75',
        'column_name': 'done',
        'merged': None
    }
    cards = CardDB(card, index='note')

    with open(os.path.join(PWD,
                           'payload_examples/card_moved_to_done.json')) as f:
        payload = json.load(f)
    event = sansio.Event(payload, event="project_card", delivery_id="12345")

    assert get_update_status_ghargs(event, database=cards) is None
Exemplo n.º 4
0
def test_get_update_status_ghargs():
    card = {
        'note': 'https://github.com/NCAR/xdev-bot-testing/issues/11',
        'column_name': 'done'
    }
    cards = CardDB(card, index='note')

    with open(os.path.join(PWD,
                           'payload_examples/card_created_issue.json')) as f:
        payload = json.load(f)
    event = sansio.Event(payload, event="project_card", delivery_id="12345")

    ghargs = GHArgs(
        'https://api.github.com/repos/NCAR/xdev-bot-testing/issues/11',
        data={'state': 'open'},
        func='patch')
    assert get_update_status_ghargs(event, database=cards) == ghargs
Exemplo n.º 5
0
def test_get_update_status_ghargs_merged_pr():
    card = {
        'note': 'https://github.com/NCAR/xdev-bot-testing/pull/75',
        'column_name': 'done',
        'merged': True
    }
    cards = CardDB(card, index='note')

    with open(
            os.path.join(
                PWD, 'payload_examples/card_moved_to_in_progress.json')) as f:
        payload = json.load(f)
    event = sansio.Event(payload, event="project_card", delivery_id="12345")

    ghargs = GHArgs('/projects/columns/cards/18727793/moves',
                    data={
                        'position': 'top',
                        'column_id': 4_507_393
                    },
                    accept='application/vnd.github.inertia-preview+json')

    assert get_update_status_ghargs(event, database=cards) == ghargs