Ejemplo n.º 1
0
    def test_poke(self):
        op = FTPSensor(path="foobar.json", ftp_conn_id="bob_ftp",
                       task_id="test_task")

        self.hook_mock.get_mod_time.side_effect = \
            [error_perm("550: Can't check for file existence"), None]

        self.assertFalse(op.poke(None))
        self.assertTrue(op.poke(None))
Ejemplo n.º 2
0
    def test_poke(self):
        op = FTPSensor(path="foobar.json", ftp_conn_id="bob_ftp",
                       task_id="test_task")

        self.hook_mock.get_mod_time.side_effect = \
            [error_perm("550: Can't check for file existence"), None]

        self.assertFalse(op.poke(None))
        self.assertTrue(op.poke(None))
Ejemplo n.º 3
0
    def test_poke_ignore_transient_error(self):
        op = FTPSensor(path="foobar.json", ftp_conn_id="bob_ftp",
                       task_id="test_task", fail_on_transient_errors=False)

        self.hook_mock.get_mod_time.side_effect = \
            [error_perm("434: Host unavailable"), None]

        self.assertFalse(op.poke(None))
        self.assertTrue(op.poke(None))
Ejemplo n.º 4
0
    def test_poke_ignore_transient_error(self, mock_hook):
        op = FTPSensor(path="foobar.json", ftp_conn_id="bob_ftp",
                       task_id="test_task", fail_on_transient_errors=False)

        mock_hook.return_value.__enter__.return_value.get_mod_time.side_effect = [
            error_perm("434: Host unavailable"), None
        ]

        self.assertFalse(op.poke(None))
        self.assertTrue(op.poke(None))
Ejemplo n.º 5
0
    def test_poke(self, mock_hook):
        op = FTPSensor(path="foobar.json", ftp_conn_id="bob_ftp",
                       task_id="test_task")

        mock_hook.return_value.__enter__.return_value.get_mod_time.side_effect = [
            error_perm("550: Can't check for file existence"),
            error_perm("550: Directory or file does not exist"),
            error_perm("550 - Directory or file does not exist"), None
        ]

        self.assertFalse(op.poke(None))
        self.assertFalse(op.poke(None))
        self.assertFalse(op.poke(None))
        self.assertTrue(op.poke(None))