Exemplo n.º 1
0
    def test_clean(self):
        """Tests the clean method of the database"""
        self.test_db.add(Gas("test"))
        self.test_db.add(Gas("test"))
        self.assertEqual(len(self.test_db.get_records()), 2)

        self.test_db.clean()
        self.assertEqual(len(self.test_db.get_records()), 0)
Exemplo n.º 2
0
    def test_add(self):
        """Tests the add method of the database"""

        original_size = len(self.test_db.get_records())
        self.test_db.add(Gas("test", self.__MY_DATE))

        records = self.test_db.get_records()
        self.assertEqual(len(records), original_size + 1)
        self.assertEqual(records[-1], Gas("test", self.__MY_DATE))
Exemplo n.º 3
0
    def test_add_wo_date(self):
        """Tests the add method of the database"""

        original_size = len(self.test_db.get_records())
        new_date = self.test_db.add(Gas("test")).date

        records = self.test_db.get_records()
        self.assertEqual(len(records), original_size + 1)
        self.assertEqual(records[-1], Gas("test", new_date))
Exemplo n.º 4
0
    def test__ne__notimplemented(self):
        """Tests the ne method for the Gas object"""

        self.assertNotEqual(Gas("test", self.__MY_DATE), "Testing string")
Exemplo n.º 5
0
    def test__ne__(self):
        """Tests the ne method for the Gas object"""

        self.assertNotEqual(Gas("test", self.__MY_DATE), Gas("test"))
Exemplo n.º 6
0
    def test__eq__(self):
        """Tests the eq method for the Gas object"""

        self.assertEqual(Gas("test", self.__MY_DATE),
                         Gas("test", self.__MY_DATE))
Exemplo n.º 7
0
    def test__str__(self):
        """Tests the str method for the Gas object"""

        self.assertEqual(str(Gas("test", self.__MY_DATE)),
                         "User: {}\nDate: {}".format("test", self.__MY_DATE))
Exemplo n.º 8
0
    def test__repr__(self):
        """Tests the repr method for the Gas object"""

        self.assertEqual(repr(Gas("test", self.__MY_DATE)),
                         "{}|{}".format("test", self.__MY_DATE))