@@ -0,0 +1,1999 @@
+from mock import MagicMock, patch%0Aimport unittest%0A%0Afrom itolapi import Itol%0A%0A%0Aclass ItolTest(unittest.TestCase):%0A    def setUp(self):%0A        self.itol = Itol.Itol()%0A%0A    def test_initializes(self):%0A        self.assertEqual(self.itol.variables, %7B%7D)%0A        self.assertIsNotNone(self.itol.comm)%0A%0A    def test_add_variable(self):%0A        self.itol.add_variable('x', 'asdf')%0A        self.assertEqual(self.itol.variables%5B'x'%5D, 'asdf')%0A%0A    def test_checks_variable_name(self):%0A        with self.assertRaises(TypeError):%0A            self.itol.add_variable(1234, 'asdf')%0A%0A    def test_checks_variable_value(self):%0A        with self.assertRaises(TypeError):%0A            self.itol.add_variable('x', 1234)%0A%0A    def test_checks_file_variable(self):%0A        with self.assertRaises(IOError):%0A            self.itol.add_variable('File', ' ')%0A%0A    def test_is_file(self):%0A        self.assertFalse(Itol.Itol.is_file('asdf'))%0A        self.assertTrue(Itol.Itol.is_file('asdfFile'))%0A%0A    def test_good_upload(self):%0A        with patch('itolapi.Comm.Comm.upload_tree') as mock_upload:%0A            mock_upload.return_value = True%0A            self.itol.comm.tree_id = 1234%0A            self.assertEqual(self.itol.upload(), 1234)%0A%0A    def test_bad_upload(self):%0A        with patch('itolapi.Comm.Comm.upload_tree') as mock_upload:%0A            mock_upload.return_value = False%0A            self.itol.comm.tree_id = 1234%0A            self.assertEqual(self.itol.upload(), 0)%0A%0A    def test_get_itol_export(self):%0A        self.itol.comm.tree_id = 1234%0A        export = self.itol.get_itol_export()%0A        self.assertEqual(export.params%5B'tree'%5D, 1234)%0A%0A    def test_print_variables(self):%0A        self.itol.print_variables()%0A%0A    def test_delete_variables(self):%0A        self.itol.add_variable('asdf', '1234')%0A        self.assertTrue('asdf' in self.itol.variables)%0A        self.itol.delete_variable('asdf')%0A        self.assertFalse('asdf' in self.itol.variables)%0A        self.assertFalse('asdf' in self.itol.variables) # Idempotent%0A

Add tests for Itol.py