From 4ebe9a964a59d424f7eeee9691fa8fca67a86098 Mon Sep 17 00:00:00 2001
From: Dmitry <b4tm4n@mail.ru>
Date: Thu, 5 Apr 2018 21:39:22 +0300
Subject: [PATCH] add some tests

---
 tests/__init__.py       |  0
 tests/test_converter.py | 36 ++++++++++++++++++++++++++++++++++++
 tests/test_imports.py   | 20 ++++++++++++++++++++
 3 files changed, 56 insertions(+)
 create mode 100644 tests/__init__.py
 create mode 100644 tests/test_converter.py
 create mode 100644 tests/test_imports.py

diff --git a/tests/__init__.py b/tests/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/tests/test_converter.py b/tests/test_converter.py
new file mode 100644
index 0000000..6404749
--- /dev/null
+++ b/tests/test_converter.py
@@ -0,0 +1,36 @@
+import unittest
+from gcal_sync import CalendarConverter
+
+ics_empty = """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//test//test//ES
+CALSCALE:GREGORIAN
+METHOD:PUBLISH
+END:VCALENDAR
+"""
+
+ics_empty_event = """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//test//test//ES
+CALSCALE:GREGORIAN
+METHOD:PUBLISH
+BEGIN:VEVENT
+END:VEVENT
+END:VCALENDAR
+"""
+
+class TestCalendarConverter(unittest.TestCase):
+    def test_empty_calendar(self):
+      converter = CalendarConverter()
+      converter.loads(ics_empty)
+      evnts = converter.events_to_gcal()
+      self.assertEqual(len(evnts), 0)
+    
+    def test_empty_event(self):
+      converter = CalendarConverter()
+      converter.loads(ics_empty_event)
+      with self.assertRaises(KeyError):
+        converter.events_to_gcal()
+
+if __name__ == '__main__':
+    unittest.main()
\ No newline at end of file
diff --git a/tests/test_imports.py b/tests/test_imports.py
new file mode 100644
index 0000000..7a150e1
--- /dev/null
+++ b/tests/test_imports.py
@@ -0,0 +1,20 @@
+import unittest
+
+class TestImports(unittest.TestCase):
+    def test_import_CalendarConverter(self):
+      from gcal_sync import CalendarConverter
+
+    def test_import_EventConverter(self):
+      from gcal_sync import EventConverter
+
+    def test_import_GoogleCalendarService(self):
+      from gcal_sync import GoogleCalendarService
+
+    def test_import_GoogleCalendar(self):
+      from gcal_sync import GoogleCalendar
+
+    def test_import_CalendarSync(self):
+      from gcal_sync import CalendarSync
+
+if __name__ == '__main__':
+    unittest.main()
\ No newline at end of file