Beispiel #1
0
    def test_invalidAddTable(self):
        """
        Tests the ability to add tables to our generator
        but with incorrect input types

        Input:
        Table instance
        """
        cur = Generator()
        with self.assertRaises(Exception):
            cur.AddTable(Generator())
Beispiel #2
0
 def test_invalidMode(self):
     """
     Sets the mode, but with an invalid input
     """
     cur = Generator()
     with self.assertRaises(Exception):
         cur.SetMode("Test")
Beispiel #3
0
    def test_reportFailureCount(self):
        """
        Test the methods handling report failure counts

        Input:
        SetFailureCount() & GetFailureCount()
        """
        cur = Generator()
        cur.SetFailureCount(2)
        self.assertEqual(cur.GetFailureCount(), 2)
Beispiel #4
0
    def test_reportSuccessCount(self):
        """
        Test the methods handling report sucess counts

        Input:
        SetSuccessCount() & GetSuccessCount()
        """
        cur = Generator()
        cur.SetSuccessCount(2)
        self.assertEqual(cur.GetSuccessCount(), 2)
Beispiel #5
0
    def test_mode(self):
        """
        Test the methods handling report modes

        Input:
        SetReportTitle() & GetMode()
        """
        cur = Generator()
        cur.SetReportTitle("test")
        self.assertEqual(cur.GetReportTitle(), "test")
Beispiel #6
0
    def test_reportDescription(self):
        """
        Test the methods handling report descriptions

        Input:
        SetReportDescription() & GetReportDescription()
        """
        cur = Generator()
        cur.SetReportDescription("test")
        self.assertEqual(cur.GetReportDescription(), "test")
Beispiel #7
0
    def test_filename(self):
        """
        Test the methods handling filenames

        Input:
        SetFilename() & GetFilename()
        """
        cur = Generator()
        cur.SetFilename("test")
        self.assertEqual(cur.GetFilename(), "test")
Beispiel #8
0
    def test_reportInvalidSucess(self):
        """
        Test the methods handling report sucess counts with invalid input

        Input:
        SetSuccessCount() & GetSuccessCount()
        """
        cur = Generator()
        with self.assertRaises(ValueError):
            cur.SetSuccessCount("test")
        self.assertEqual(cur.GetSuccessCount(), 0)
Beispiel #9
0
    def test_addTable(self):
        """
        Tests the ability to add tables to our generator

        Input:
        Table instance
        """
        cur = Generator()
        table = Table()
        cur.AddTable(table)
        self.assertEqual(len(cur.tables), 1)
Beispiel #10
0
    def test_getTable(self):
        """
        Tests the abilty to get tables back out

        Output:
        Table instance
        """
        cur = Generator()
        t = Table("Test")
        cur.AddTable(t)
        data = cur.GetTable("Test")
        self.assertEqual(data, t)
Beispiel #11
0
    def test_addDuplicateTable(self):
        """
        Tests the ability to add tables to our generator
        but with duplicate table titles

        Input:
        Table instance
        """
        cur = Generator()
        cur.AddTable(Table("Test"))
        with self.assertRaises(KeyError):
            cur.AddTable(Table("Test"))
Beispiel #12
0
 def test_generatorInit(self):
     """
     Test __init__ values
     """
     cur = Generator()
     self.assertEqual(cur.GetReportTitle(),
                      "Test Tables",
                      msg="Report Title")
     self.assertEqual(cur.GetReportDescription(),
                      "",
                      msg="Report Description")
     self.assertEqual(cur.GetSuccessCount(), 0, msg="Success count")
     self.assertEqual(cur.GetFailureCount(), 0, msg="Failure count")
     self.assertEqual(cur.GetErrorCount(), 0, msg="Error count")
     self.assertEqual(cur.tables, {}, msg="Tables")
Beispiel #13
0
    def __init__(self, stream=sys.stdout, verbosity=1):
        self.stream = stream
        self.verbosity = verbosity

        self.generator = Generator()