Exemple #1
0
        def test_token_is_ok(token, preprocess=None, postprocess=None):
            """Check if inspect_request for the `token` returns a reply.

            Run code in `preprocess` before requesting if it's given,
            and `proprocess` after requesting.

            Currently just test if the kernel replys without an error
            and not care about its content.
            Because the contents of inspections are still so arguable.
            When the requirements for the contents are decided,
            fix the tests beow and check the contents.
            """
            if preprocess:
                self._execute_code(preprocess, tests=False)

            msg_id = self.kc.inspect(token)
            reply = self.kc.get_shell_msg(timeout=TIMEOUT)
            validate_message(reply, 'inspect_reply', msg_id)

            self.assertEqual(reply['content']['status'], 'ok')
            self.assertTrue(reply['content']['found'])
            self.assertGreaterEqual(len(reply['content']['data']), 1)

            if postprocess:
                self._execute_code(postprocess, tests=False)
Exemple #2
0
        def test_token_is_ok(token, preprocess=None, postprocess=None):
            """Check if inspect_request for the `token` returns a reply.

            Run code in `preprocess` before requesting if it's given,
            and `proprocess` after requesting.

            Currently just test if the kernel replys without an error
            and not care about its content.
            Because the contents of inspections are still so arguable.
            When the requirements for the contents are decided,
            fix the tests beow and check the contents.
            """
            if preprocess:
                self._execute_code(preprocess, tests=False)

            msg_id = self.kc.inspect(token)
            reply = self.kc.get_shell_msg(timeout=TIMEOUT)
            validate_message(reply, 'inspect_reply', msg_id)

            self.assertEqual(reply['content']['status'], 'ok')
            self.assertTrue(reply['content']['found'])
            self.assertGreaterEqual(len(reply['content']['data']), 1)

            if postprocess:
                self._execute_code(postprocess, tests=False)