Example #1
0
class RegressionsTestCase(unittest.TestCase):

    def setUp(self):
        self.sca = SoftwareCenterAgent()
        self.sca.emit = Mock()
        
    def _get_exhibit_list_from_emit_call(self):
        args, kwargs = self.sca.emit.call_args
        scagent, exhibit_list = args
        return exhibit_list

    def test_regression_lp1004417(self):
        mock_ex = Mock()
        mock_ex.package_names = "foo,bar\n\r"
        results = [mock_ex]
        self.sca._on_exhibits_data_available(None, results)
        self.assertTrue(self.sca.emit.called)
        # and ensure we get the right list len
        exhibit_list = self._get_exhibit_list_from_emit_call()
        self.assertEqual(len(exhibit_list), 1)
        # and the right data in the list
        exhibit = exhibit_list[0]
        self.assertEqual(exhibit.package_names, "foo,bar")
        self.assertFalse(exhibit.package_names.endswith("\n\r"))

    def test_regression_lp1043152(self):
        mock_ex = Mock()
        mock_ex.package_names = "moo, baa, lalala"
        results = [mock_ex]
        self.sca._on_exhibits_data_available(None, results)
        # ensure that the right data in the list
        exhibit = self._get_exhibit_list_from_emit_call()[0]
        self.assertEqual(exhibit.package_names, "moo,baa,lalala")
Example #2
0
class RegressionsTestCase(unittest.TestCase):
    def setUp(self):
        self.sca = SoftwareCenterAgent()
        self.sca.emit = Mock()

    def _get_exhibit_list_from_emit_call(self):
        args, kwargs = self.sca.emit.call_args
        scagent, exhibit_list = args
        return exhibit_list

    def test_regression_lp1004417(self):
        mock_ex = Mock()
        mock_ex.package_names = "foo,bar\n\r"
        results = [mock_ex]
        self.sca._on_exhibits_data_available(None, results)
        self.assertTrue(self.sca.emit.called)
        # and ensure we get the right list len
        exhibit_list = self._get_exhibit_list_from_emit_call()
        self.assertEqual(len(exhibit_list), 1)
        # and the right data in the list
        exhibit = exhibit_list[0]
        self.assertEqual(exhibit.package_names, "foo,bar")
        self.assertFalse(exhibit.package_names.endswith("\n\r"))

    def test_regression_lp1043152(self):
        mock_ex = Mock()
        mock_ex.package_names = "moo, baa, lalala"
        results = [mock_ex]
        self.sca._on_exhibits_data_available(None, results)
        # ensure that the right data in the list
        exhibit = self._get_exhibit_list_from_emit_call()[0]
        self.assertEqual(exhibit.package_names, "moo,baa,lalala")
 def test_regression_lp1004417(self):
     mock_ex = Mock()
     mock_ex.package_names = "foo,bar\n\r"
     results = [mock_ex]
     sca = SoftwareCenterAgent()
     sca.emit = Mock()
     sca._on_exhibits_data_available(None, results)
     self.assertTrue(sca.emit.called)
     # get the args to "emit()"
     args, kwargs = sca.emit.call_args
     # split the args up
     scagent, exhibit_list = args
     # and ensure we get the right list len
     self.assertEqual(len(exhibit_list), 1)
     # and the right data in the list
     exhibit = exhibit_list[0]
     self.assertEqual(exhibit.package_names, "foo,bar")
     self.assertFalse(exhibit.package_names.endswith("\n\r"))
Example #4
0
 def test_regression_lp1004417(self):
     mock_ex = Mock()
     mock_ex.package_names = "foo,bar\n\r"
     results = [mock_ex]
     sca = SoftwareCenterAgent()
     sca.emit = Mock()
     sca._on_exhibits_data_available(None, results)
     self.assertTrue(sca.emit.called)
     # get the args to "emit()"
     args, kwargs = sca.emit.call_args
     # split the args up
     scagent, exhibit_list = args
     # and ensure we get the right list len
     self.assertEqual(len(exhibit_list), 1)
     # and the right data in the list
     exhibit = exhibit_list[0]
     self.assertEqual(exhibit.package_names, "foo,bar")
     self.assertFalse(exhibit.package_names.endswith("\n\r"))