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: |''')
def test_publish_sheets_integration_test_remove_all_pass(mocker): SheetResponse = namedtuple('SheetResponse', 'valid messages') Grade = namedtuple('Grade', 'check grade issue') grades = { 'Description': True, 'Data Source': True, 'Deprecated': True, } grade = GSheetChecker('fake.table', 'id', 'name', 'TESTING').grade(add=False, report_value=SheetResponse( True, grades)) attributes = {} issue = Issue(REQUESTER, {}, attributes, True) issue.create_comment = spy = mocker.MagicMock() conductor.publish_grades( {'table.name': [Grade('sheetchecker', grade, issue)]}, True) spy.assert_called_once_with('''## conductor results for table.name | check | status | | - | :-: | | sheetchecker | | | - deprecation issue link | :+1: |''')
def test_publish_grades_formats_table(mocker): Grade = namedtuple('Grade', 'check grade issue') attributes = {} issue = Issue(REQUESTER, {}, attributes, True) issue.create_comment = spy = mocker.MagicMock() conductor.publish_grades({'table.name': [Grade('check', 'grade', issue)]}, True) spy.assert_called_once_with( '## conductor results for table.name\n\n| check | status |\n| - | :-: |\n| check | grade |' )
def test_table_checker_grade_integration_remove_fail(mocker): Grade = namedtuple('Grade', 'check grade issue') grade = TableChecker('table.name', {}).grade(add=False, report_value=True) attributes = {} issue = Issue(REQUESTER, {}, attributes, True) issue.create_comment = spy = mocker.MagicMock() conductor.publish_grades( {'table.name': [Grade('tablechecker', grade, issue)]}, True) spy.assert_called_once_with('''## conductor results for table.name | check | status | | - | :-: | | tablechecker | :no_entry: |''')
def test_url_checker_grade_integration_add_success(mocker): Grade = namedtuple('Grade', 'check grade issue') grade = UrlChecker().grade(add=True, report_value=True) attributes = {} issue = Issue(REQUESTER, {}, attributes, True) issue.create_comment = spy = mocker.MagicMock() conductor.publish_grades( {'table.name': [Grade('urlchecker', grade, issue)]}, True) spy.assert_called_once_with('''## conductor results for table.name | check | status | | - | :-: | | urlchecker | :+1: |''')