示例#1
0
    def test_is_oppia_server_already_running_when_a_port_is_open(self):
        self.exit_stack.enter_context(
            self.swap_with_checks(
                common, 'is_port_in_use',
                lambda port: port == run_e2e_tests.GOOGLE_APP_ENGINE_PORT))

        self.assertTrue(run_e2e_tests.is_oppia_server_already_running())
示例#2
0
    def test_is_oppia_server_already_running_when_ports_closed(self):
        def mock_is_port_open(unused_port):
            return False

        is_port_open_swap = self.swap_with_checks(common, 'is_port_open',
                                                  mock_is_port_open)
        with is_port_open_swap:
            result = run_e2e_tests.is_oppia_server_already_running()
            self.assertFalse(result)
示例#3
0
    def test_is_oppia_server_already_running_when_one_of_the_ports_is_open(
            self):
        running_port = run_e2e_tests.GOOGLE_APP_ENGINE_PORT
        def mock_is_port_open(port):
            if port == running_port:
                return True
            return False

        is_port_open_swap = self.swap_with_checks(
            common, 'is_port_open', mock_is_port_open)
        with is_port_open_swap:
            result = run_e2e_tests.is_oppia_server_already_running()
            self.assertTrue(result)
示例#4
0
    def test_is_oppia_server_already_running_when_ports_closed(self):
        self.exit_stack.enter_context(
            self.swap_to_always_return(common, 'is_port_in_use', value=False))

        self.assertFalse(run_e2e_tests.is_oppia_server_already_running())