diff --git a/server.py b/server.py
index 4084baeac..6438dbcb4 100644
--- a/server.py
+++ b/server.py
@@ -26,7 +26,11 @@ def index():
 
 @app.route('/showSummary',methods=['POST'])
 def showSummary():
-    club = [club for club in clubs if club['email'] == request.form['email']][0]
+    try:
+        club = [club for club in clubs if club['email'] == request.form['email']][0]
+    except IndexError:
+        flash("email not found or invalid please try again")
+        return redirect(url_for('index'))
     return render_template('welcome.html',club=club,competitions=competitions)
 
 
@@ -56,4 +60,7 @@ def purchasePlaces():
 
 @app.route('/logout')
 def logout():
-    return redirect(url_for('index'))
\ No newline at end of file
+    return redirect(url_for('index'))
+
+if __name__ == '__main__':
+    app.run(debug=True)
diff --git a/tests/__init__.py b/tests/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/tests/unit_tests/__init__.py b/tests/unit_tests/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/tests/unit_tests/conftest.py b/tests/unit_tests/conftest.py
new file mode 100644
index 000000000..ad2e53992
--- /dev/null
+++ b/tests/unit_tests/conftest.py
@@ -0,0 +1,9 @@
+import pytest
+
+from server import app
+
+
+@pytest.fixture
+def client():
+    app.config["TESTING"] = True
+    return app.test_client()
\ No newline at end of file
diff --git a/tests/unit_tests/test_valid_or_invalid_mail.py b/tests/unit_tests/test_valid_or_invalid_mail.py
new file mode 100644
index 000000000..a78f8e5eb
--- /dev/null
+++ b/tests/unit_tests/test_valid_or_invalid_mail.py
@@ -0,0 +1,22 @@
+import pytest
+
+def test_connection_with_valid_email(client):
+    result = client.post("/showSummary", data={"email": "john@simplylift.co"})
+    assert result.status_code == 200
+    assert f"john@simplylift.co" in result.data.decode()
+
+def test_connection_with_invalid_email_no_at(client):
+    result = client.post("/showSummary", data={"email": "johnsimplylift.co"})
+    assert result.status_code == 302
+
+def test_connection_with_invalid_email_no_dot(client):
+    result = client.post("/showSummary", data={"email": "john@simplyliftco"})
+    assert result.status_code == 302
+
+def test_connection_with_empty_email(client):
+    result = client.post("/showSummary", data={"email": ""})
+    assert result.status_code == 302
+
+def test_logout(client):
+    result = client.get("/logout")
+    assert result.status_code == 302
\ No newline at end of file