Esempio n. 1
0
 def setUp(self):
     self.object = Activity("NameA",
                            description="DescriptionA",
                            start=datetime(2016, 2, 1),
                            end=datetime(2017, 2, 1),
                            interval=3)
Esempio n. 2
0
 def setUp(self):
     self.object = Activity("NameA",
                            description="DescriptionA",
                            start=datetime(2016, 2, 1),
                            end=datetime(2017, 2, 1),
                            interval=3)
Esempio n. 3
0
class ActivityUnitTester(unittest.TestCase):
    """
    Tester for the auxi.modelling.business.structure.Activity class.
    """

    def setUp(self):
        self.object = Activity("NameA",
                               description="DescriptionA",
                               start=datetime(2016, 2, 1),
                               end=datetime(2017, 2, 1),
                               interval=3)

    def test_constructor(self):
        self.assertEqual(self.object.name, "NameA")
        self.assertEqual(self.object.description, "DescriptionA")
        self.assertEqual(self.object.start_datetime, datetime(2016, 2, 1))
        self.assertEqual(self.object.end_datetime, datetime(2017, 2, 1))
        self.assertEqual(self.object.interval, 3)

    def test_get_path(self):
        self.object.set_parent_path("entityA/componentA")
        self.assertEqual(self.object.path, "entityA/componentA/NameA")

    def test_set_parent_path(self):
        self.object.set_parent_path("entityA/componentA")
        self.assertEqual(self.object.path, "entityA/componentA/NameA")

    def test_set_name(self):
        """
        Test wether the name changes when it is set
        and that the activity's path is updated correctly.
        """
        self.object.set_parent_path("entityA/componentA")
        self.object.name = "NameAt"
        self.assertEqual(self.object.name, "NameAt")
        self.assertEqual(self.object.path, "entityA/componentA/NameAt")

    def test__meet_exection_criteria(self):
        clock = Clock("NameA", start_datetime=datetime(2016, 1, 1))
        self.object.prepare_to_run(clock, 13)
        self.assertEqual(self.object._meet_execution_criteria(3), False)
        self.assertEqual(self.object._meet_execution_criteria(5), True)
        self.assertEqual(self.object._meet_execution_criteria(40), False)

    def test_prepare_to_run(self):
        clock = Clock("NameA", start_datetime=datetime(2016, 1, 1))
        self.object.prepare_to_run(clock, 18)
        self.assertEqual(self.object.start_period_ix, 2)
        self.assertEqual(self.object.end_period_ix, 14)

    def test_get_referenced_accounts(self):
        self.assertEqual(len(self.object.get_referenced_accouts()), 0)
Esempio n. 4
0
class ActivityUnitTester(unittest.TestCase):
    """
    Tester for the auxi.modelling.business.structure.Activity class.
    """
    def setUp(self):
        self.object = Activity("NameA",
                               description="DescriptionA",
                               start=datetime(2016, 2, 1),
                               end=datetime(2017, 2, 1),
                               interval=3)

    def test_constructor(self):
        self.assertEqual(self.object.name, "NameA")
        self.assertEqual(self.object.description, "DescriptionA")
        self.assertEqual(self.object.start_datetime, datetime(2016, 2, 1))
        self.assertEqual(self.object.end_datetime, datetime(2017, 2, 1))
        self.assertEqual(self.object.interval, 3)

    def test_get_path(self):
        self.object.set_parent_path("entityA/componentA")
        self.assertEqual(self.object.path, "entityA/componentA/NameA")

    def test_set_parent_path(self):
        self.object.set_parent_path("entityA/componentA")
        self.assertEqual(self.object.path, "entityA/componentA/NameA")

    def test_set_name(self):
        """
        Test whether the name changes when it is set
        and that the activity's path is updated correctly.
        """
        self.object.set_parent_path("entityA/componentA")
        self.object.name = "NameAt"
        self.assertEqual(self.object.name, "NameAt")
        self.assertEqual(self.object.path, "entityA/componentA/NameAt")

    def test__meet_execution_criteria(self):
        clock = Clock("NameA", start_datetime=datetime(2016, 1, 1))
        self.object.prepare_to_run(clock, 13)
        self.assertEqual(self.object._meet_execution_criteria(3), False)
        self.assertEqual(self.object._meet_execution_criteria(5), True)
        self.assertEqual(self.object._meet_execution_criteria(40), False)

    def test_prepare_to_run(self):
        clock = Clock("NameA", start_datetime=datetime(2016, 1, 1))
        self.object.prepare_to_run(clock, 18)
        self.assertEqual(self.object.start_period_ix, 2)
        self.assertEqual(self.object.end_period_ix, 14)

    def test_get_referenced_accounts(self):
        self.assertEqual(len(self.object.get_referenced_accounts()), 0)