1diff --git a/flake8/utils.py b/flake8/utils.py
2index f6ce384..7cd12b0 100644
3--- a/flake8/utils.py
4+++ b/flake8/utils.py
5@@ -75,8 +75,8 @@ def stdin_get_value():
6     return cached_value.getvalue()
7
8
9-def parse_unified_diff():
10-    # type: () -> List[str]
11+def parse_unified_diff(diff=None):
12+    # type: (str) -> List[str]
13     """Parse the unified diff passed on stdin.
14
15     :returns:
16@@ -84,7 +84,10 @@ def parse_unified_diff():
17     :rtype:
18         dict
19     """
20-    diff = stdin_get_value()
21+    # Allow us to not have to patch out stdin_get_value
22+    if diff is None:
23+        diff = stdin_get_value()
24+
25     number_of_rows = None
26     current_path = None
27     parsed_paths = collections.defaultdict(set)
28diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py
29index d69d939..21482ce 100644
30--- a/tests/unit/test_utils.py
31+++ b/tests/unit/test_utils.py
32@@ -115,3 +115,13 @@ def test_parameters_for_function_plugin():
33     plugin = plugin_manager.Plugin('plugin-name', object())
34     plugin._plugin = fake_plugin
35     assert utils.parameters_for(plugin) == ['physical_line', 'self', 'tree']
36+
37+
38+def read_diff_file(filename):
39+    """Read the diff file in its entirety."""
40+    with open(filename, 'r') as fd:
41+        content = fd.read()
42+    return content
43+
44+
45+SINGLE_FILE_DIFF = read_diff_file('tests/fixtures/diffs/single_file_diff')
46