@mock.patch.object(push.Screen, 'getWaitingConnections')
    def test_quitPage(self, mock_getWaitingConnections):

        waiting_connections = []
        # Add elements to self.connections
        device_len = random.randint(1, 20)
        device_names = []
        configlet = mock.MagicMock()
        configlet.device = mock.MagicMock()

        for i in range(device_len):
            configlet.device.name = 'configlet' + str(i)
            device_names.append(configlet.device.name)
            curr_configlet = copy.deepcopy(configlet)

            waiting_connections.append(curr_configlet)

        mock_getWaitingConnections.return_value = waiting_connections

        lines = self.screen.quitPage()

        lines = lines[3:device_len + 3]
        self.assertEqual(lines, device_names)
This tests the quitPage method of Screen class.
dataset/ETHPy150Open facebook/fbpush/tests/test_push.py/FBPushScreenTestCase.test_quitPage