# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function,
                        unicode_literals)

import defcon
import pytest

from fontbakery.checkrunner import (DEBUG, ENDCHECK, ERROR, FAIL, INFO, PASS,
                                    SKIP, WARN)

check_statuses = (ERROR, FAIL, SKIP, PASS, WARN, INFO, DEBUG)


@pytest.fixture
def empty_ufo_font(tmpdir):
    ufo = defcon.Font()
    ufo_path = str(tmpdir.join("empty_font.ufo"))
    ufo.save(ufo_path)
    return ufo_path


def test_check_required_fields(empty_ufo_font):
    from fontbakery.specifications.ufo_sources import (
        com_daltonmaag_check_required_fields as check)

    print('Test FAIL with empty UFO.')
    c = list(check(empty_ufo_font))
    status, message = c[-1]
    assert status == FAIL

@@ -498,16 +498,22 @@
   return
+ (ufo,
  ufo_pat
@@ -513,16 +513,17 @@
 ufo_path
+)
 %0A%0A%0Adef t
@@ -675,16 +675,51 @@
 s check)
+%0A    ufo, ufo_path = empty_ufo_font
 %0A%0A    pr
@@ -770,30 +770,353 @@
 t(check(
-empty_ufo_font
+ufo_path))%0A    status, message = c%5B-1%5D%0A    assert status == FAIL%0A%0A    ufo.info.unitsPerEm = 1000%0A    ufo.info.ascender = 800%0A    ufo.info.descender = -200%0A    ufo.info.xHeight = 500%0A    ufo.info.capHeight = 700%0A    ufo.info.familyName = %22Test%22%0A    ufo.save()%0A    %0A    print('Test PASS with almost empty UFO.')%0A    c = list(check(ufo_path
 ))%0A    s
@@ -1143,29 +1143,29 @@
 1%5D%0A    assert status == 
-FAIL
+PASS
 %0A

Test both failure and success of check for required fields