Beispiel #1
0
def test_empty_row_returns_false(mocker):
    mocker.patch('conductor.checks.TableChecker.get_data')

    patient = MetaTableChecker('sgid.fake.table', SECRETS['internalsgid'])
    response = patient.exists()

    assert response.exists == False
Beispiel #2
0
def test_missing_all_returns_correct_string(mocker):
    mocker.patch('conductor.checks.TableChecker.get_data')
    patient = MetaTableChecker('sgid.fake.table', SECRETS['internalsgid'])
    patient.data = (None, None, None)

    response = patient.exists()

    assert response.exists == False
Beispiel #3
0
def test_metatable_response_returns_true_when_exists():
    patient = MetaTableChecker('sgid.boundaries.municipalities',
                               SECRETS['internalsgid'])
    response = patient.exists()

    assert response.exists == True
    assert patient.data.item_id == '543fa1f073714198a3dbf8a292bdf30c'
    assert patient.data.item_name == 'Utah Municipal Boundaries'
Beispiel #4
0
def test_missing_geometry_type_returns_correct_string(mocker):
    mocker.patch('conductor.checks.TableChecker.get_data')

    patient = MetaTableChecker('sgid.fake.table', SECRETS['internalsgid'])
    patient.data = ('some-guid', 'agol name', None)

    response = patient.exists()

    assert response.exists == 'missing geometry type'
Beispiel #5
0
def test_missing_item_id_returns_correct_string(mocker):
    mocker.patch('conductor.checks.TableChecker.get_data')

    patient = MetaTableChecker('sgid.fake.table', SECRETS['internalsgid'])
    patient.data = (None, 'Agol Published Name', 'geometry type')

    response = patient.exists()

    assert response.exists == 'missing item id'
Beispiel #6
0
def test_metatable_checker_grade_integration_add_success(mocker):
    MetaResponse = namedtuple('MetaResponse',
                              'exists item_id item_name geometry_type')
    Grade = namedtuple('Grade', 'check grade issue')
    grade = MetaTableChecker('table.name',
                             {}).grade(add=True,
                                       report_value=MetaResponse(
                                           True, 'item id', 'item name',
                                           'geometry type'))

    attributes = {}
    issue = Issue(REQUESTER, {}, attributes, True)
    issue.create_comment = spy = mocker.MagicMock()

    conductor.publish_grades(
        {'table.name': [Grade('meta table', grade, issue)]}, True)

    spy.assert_called_once_with('''## conductor results for table.name

| check | status |
| - | :-: |
| meta table |  |
| - item id | :+1: |
| - item name | :+1: |
| - geometry type | :+1: |''')
Beispiel #7
0
def test_response_returns_completely_missing_for_fake_table():
    patient = MetaTableChecker('sgid.fake.table', SECRETS['internalsgid'])
    response = patient.exists()

    assert response.exists == False