Exemplo n.º 1
0
    def case_delete_records(self, refresh_db_before):
        """ Create new record in Ip table and then delete it."""
        new_address = "0.0.0.0"

        IpOp.add(new_address)

        ip_obj = IpOp.get(address=new_address)
        self.assertTrue(len(ip_obj) is 1)
        self.assertEqual(ip_obj[0].address, new_address)

        IpOp.delete(ip_obj[0])

        ip_obj = IpOp.get(address=new_address)
        self.assertFalse(ip_obj)
Exemplo n.º 2
0
    def test_delete(self, mock_ip, mock_db):
        """ Assumptions:
                - delete method run
        """
        ip_obj = mock_ip()

        IpOp.delete(ip_obj)

        db_exp_calls = [
            mock.call.session.delete(ip_obj),
            mock.call.session.commit()
        ]

        mock_db.assert_has_calls(db_exp_calls)