Add check_case_conflict hook #21
diff --git a/tests/check_added_large_files_test.py b/tests/check_added_large_files_test.py
index b0ae4cd..b72a315 100644
--- a/tests/check_added_large_files_test.py
+++ b/tests/check_added_large_files_test.py
@@ -1,26 +1,11 @@
 from __future__ import absolute_import
 from __future__ import unicode_literals
 
-import io
-
-import pytest
 from plumbum import local
 
 from pre_commit_hooks.check_added_large_files import find_large_added_files
 from pre_commit_hooks.check_added_large_files import main
-
-
-@pytest.yield_fixture
-def temp_git_dir(tmpdir):
-    git_dir = tmpdir.join('gits').strpath
-    local['git']('init', git_dir)
-    yield git_dir
-
-
-def write_file(filename, contents):
-    """Hax because coveragepy chokes on nested context managers."""
-    with io.open(filename, 'w') as file_obj:
-        file_obj.write(contents)
+from testing.util import write_file
 
 
 def test_nothing_added(temp_git_dir):
diff --git a/tests/check_case_conflict_test.py b/tests/check_case_conflict_test.py
new file mode 100644
index 0000000..344725d
--- /dev/null
+++ b/tests/check_case_conflict_test.py
@@ -0,0 +1,66 @@
+from __future__ import absolute_import
+from __future__ import unicode_literals
+
+from plumbum import local
+
+from pre_commit_hooks.check_case_conflict import find_conflicting_filenames
+from pre_commit_hooks.check_case_conflict import main
+from testing.util import write_file
+
+
+def test_nothing_added(temp_git_dir):
+    with local.cwd(temp_git_dir):
+        assert find_conflicting_filenames(['f.py']) == 0
+
+
+def test_adding_something(temp_git_dir):
+    with local.cwd(temp_git_dir):
+        write_file('f.py', "print('hello world')")
+        local['git']('add', 'f.py')
+
+        assert find_conflicting_filenames(['f.py']) == 0
+
+
+def test_adding_something_with_conflict(temp_git_dir):
+    with local.cwd(temp_git_dir):
+        write_file('f.py', "print('hello world')")
+        local['git']('add', 'f.py')
+        write_file('F.py', "print('hello world')")
+        local['git']('add', 'F.py')
+
+        assert find_conflicting_filenames(['f.py', 'F.py']) == 1
+
+
+def test_added_file_not_in_pre_commits_list(temp_git_dir):
+    with local.cwd(temp_git_dir):
+        write_file('f.py', "print('hello world')")
+        local['git']('add', 'f.py')
+
+        assert find_conflicting_filenames(['g.py']) == 0
+
+
+def test_file_conflicts_with_committed_file(temp_git_dir):
+    with local.cwd(temp_git_dir):
+        write_file('f.py', "print('hello world')")
+        local['git']('add', 'f.py')
+        local['git']('commit', '--no-verify', '-m', 'Add f.py')
+
+        write_file('F.py', "print('hello world')")
+        local['git']('add', 'F.py')
+
+        assert find_conflicting_filenames(['F.py']) == 1
+
+
+def test_integration(temp_git_dir):
+    with local.cwd(temp_git_dir):
+        assert main(argv=[]) == 0
+
+        write_file('f.py', "print('hello world')")
+        local['git']('add', 'f.py')
+
+        assert main(argv=['f.py']) == 0
+
+        write_file('F.py', "print('hello world')")
+        local['git']('add', 'F.py')
+
+        assert main(argv=['F.py']) == 1
diff --git a/tests/conftest.py b/tests/conftest.py
new file mode 100644
index 0000000..157da6b
--- /dev/null
+++ b/tests/conftest.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+from __future__ import print_function
+from __future__ import unicode_literals
+
+import pytest
+from plumbum import local
+
+
+@pytest.yield_fixture
+def temp_git_dir(tmpdir):
+    git_dir = tmpdir.join('gits').strpath
+    local['git']('init', git_dir)
+    yield git_dir