Exemplo n.º 1
0
 def test_all(self):
     """
     One '--all' option will set exportAll to True
     """
     eo = ExportOptions()
     eo.parseOptions(["--all"])
     self.assertTrue(eo.exportAll)
Exemplo n.º 2
0
 def test_allContacts(self):
     """
     '--all --contacts' will set exportAllType to "VCARD"
     """
     eo = ExportOptions()
     eo.parseOptions(["--all", "--contacts"])
     self.assertTrue(eo.exportAll)
     self.assertEquals(eo.exportAllType, "VCARD")
Exemplo n.º 3
0
 def test_oneUID(self):
     """
     One '--uid' option will result in a single L{UIDExporter} object with no
     calendars in its list.
     """
     eo = ExportOptions()
     eo.parseOptions(["--uid", "bob's your guid"])
     self.assertEquals(len(eo.exporters), 1)
     exp = eo.exporters[0]
     self.assertIsInstance(exp, UIDExporter)
     self.assertEquals(exp.uid, "bob's your guid")
Exemplo n.º 4
0
 def test_oneUID(self):
     """
     One '--uid' option will result in a single L{UIDExporter} object with no
     calendars in its list.
     """
     eo = ExportOptions()
     eo.parseOptions(["--uid", "bob's your guid"])
     self.assertEquals(len(eo.exporters), 1)
     exp = eo.exporters[0]
     self.assertIsInstance(exp, UIDExporter)
     self.assertEquals(exp.uid, "bob's your guid")
Exemplo n.º 5
0
 def test_oneRecord(self):
     """
     One '--record' option will result in a single L{DirectoryExporter}
     object with no calendars in its list.
     """
     eo = ExportOptions()
     eo.parseOptions(["--record", "users:bob"])
     self.assertEquals(len(eo.exporters), 1)
     exp = eo.exporters[0]
     self.assertIsInstance(exp, DirectoryExporter)
     self.assertEquals(exp.recordType, "users")
     self.assertEquals(exp.shortName, "bob")
     self.assertEquals(exp.collections, [])
Exemplo n.º 6
0
 def test_oneRecord(self):
     """
     One '--record' option will result in a single L{DirectoryExporter}
     object with no calendars in its list.
     """
     eo = ExportOptions()
     eo.parseOptions(["--record", "users:bob"])
     self.assertEquals(len(eo.exporters), 1)
     exp = eo.exporters[0]
     self.assertIsInstance(exp, DirectoryExporter)
     self.assertEquals(exp.recordType, "users")
     self.assertEquals(exp.shortName, "bob")
     self.assertEquals(exp.collections, [])
Exemplo n.º 7
0
 def test_homeAndCollections(self):
     """
     The --collection option adds specific calendars to the last home that
     was exported.
     """
     eo = ExportOptions()
     eo.parseOptions([
         "--record", "users:bob", "--collection", "work stuff", "--uid",
         "jethroUID", "--collection=fun stuff"
     ])
     self.assertEquals(len(eo.exporters), 2)
     exp = eo.exporters[0]
     self.assertEquals(exp.recordType, "users")
     self.assertEquals(exp.shortName, "bob")
     self.assertEquals(exp.collections, ["work stuff"])
     exp = eo.exporters[1]
     self.assertEquals(exp.uid, "jethroUID")
     self.assertEquals(exp.collections, ["fun stuff"])
Exemplo n.º 8
0
 def test_homeAndCollections(self):
     """
     The --collection option adds specific calendars to the last home that
     was exported.
     """
     eo = ExportOptions()
     eo.parseOptions(["--record", "users:bob",
                      "--collection", "work stuff",
                      "--uid", "jethroUID",
                      "--collection=fun stuff"])
     self.assertEquals(len(eo.exporters), 2)
     exp = eo.exporters[0]
     self.assertEquals(exp.recordType, "users")
     self.assertEquals(exp.shortName, "bob")
     self.assertEquals(exp.collections, ["work stuff"])
     exp = eo.exporters[1]
     self.assertEquals(exp.uid, "jethroUID")
     self.assertEquals(exp.collections, ["fun stuff"])
Exemplo n.º 9
0
 def test_outputFileSelection(self):
     """
     The --output option selects the file to write to, '-' or no parameter
     meaning stdout; the L{ExportOptions.openOutput} method returns that
     file.
     """
     eo = ExportOptions()
     eo.parseOptions([])
     self.assertIdentical(eo.openOutput(), sys.stdout)
     eo = ExportOptions()
     eo.parseOptions(["--output", "-"])
     self.assertIdentical(eo.openOutput(), sys.stdout)
     eo = ExportOptions()
     tmpnam = self.mktemp()
     eo.parseOptions(["--output", tmpnam])
     self.assertEquals(eo.openOutput().name, tmpnam)
Exemplo n.º 10
0
 def test_outputFileSelection(self):
     """
     The --output option selects the file to write to, '-' or no parameter
     meaning stdout; the L{ExportOptions.openOutput} method returns that
     file.
     """
     eo = ExportOptions()
     eo.parseOptions([])
     self.assertIdentical(eo.openOutput(), sys.stdout)
     eo = ExportOptions()
     eo.parseOptions(["--output", "-"])
     self.assertIdentical(eo.openOutput(), sys.stdout)
     eo = ExportOptions()
     tmpnam = self.mktemp()
     eo.parseOptions(["--output", tmpnam])
     self.assertEquals(eo.openOutput().name, tmpnam)