def test_empty_file(in_process, git_repo_path, init_sha):
    call_conduit.side_effect = (dict(), dict(data=[dict(phid='PHID-REPO-1', fields=dict(vcs='git'))]), dict(dict(phid='PHID-DIFF-1', diffid='1')), dict(), dict(object=dict(id='123')), dict())
    testfile = (git_repo_path / 'X')
    testfile.touch()
    git_out('add', '.')
    git_out('commit', '--message', 'A')
    mozphab.main(['submit', '--yes', '--bug', '1', init_sha], is_development=True)
    log = git_out('log', '--format=%s%n%n%b', '-1')
    expected = '\nBug 1 - A\n\nDifferential Revision: http://example.test/D123\n'
    assert (log.strip() == expected.strip())
    call_conduit.reset_mock()
    call_conduit.side_effect = (dict(dict(phid='PHID-DIFF-2', diffid='2')), dict(), dict(object=dict(id='124')), dict())
    testfile.unlink()
    git_out('commit', '-a', '--message', 'B')
    mozphab.main(['submit', '--yes', '--bug', '1', 'HEAD~'], is_development=True)
    log = git_out('log', '--format=%s%n%n%b', '-1')
    expected = '\nBug 1 - B\n\nDifferential Revision: http://example.test/D124\n'
    assert (log.strip() == expected.strip())
def test_empty_file(in_process, git_repo_path, init_sha):
    call_conduit.side_effect = (dict(), dict(data=[dict(phid='PHID-REPO-1', fields=dict(vcs='git'))]), dict(dict(phid='PHID-DIFF-1', diffid='1')), dict(), dict(object=dict(id='123')), dict())
    testfile = (git_repo_path / 'X')
    testfile.touch()
    git_out('add', '.')
    git_out('commit', '--message', 'A')
    mozphab.main(['submit', '--yes', '--bug', '1', init_sha], is_development=True)
    log = git_out('log', '--format=%s%n%n%b', '-1')
    expected = '\nBug 1 - A\n\nDifferential Revision: http://example.test/D123\n'
    assert (log.strip() == expected.strip())
    call_conduit.reset_mock()
    call_conduit.side_effect = (dict(dict(phid='PHID-DIFF-2', diffid='2')), dict(), dict(object=dict(id='124')), dict())
    testfile.unlink()
    git_out('commit', '-a', '--message', 'B')
    mozphab.main(['submit', '--yes', '--bug', '1', 'HEAD~'], is_development=True)
    log = git_out('log', '--format=%s%n%n%b', '-1')
    expected = '\nBug 1 - B\n\nDifferential Revision: http://example.test/D124\n'
    assert (log.strip() == expected.strip())