def test_list_convert_to_string(self, mock_list_convert_to_byte_string_utf8):
     mock_object1 = mock_factory.create_mock_object_with_str("mock_object")
     mock_object2 = mock_factory.create_mock_object_with_str(b"mock_object")
     mock_object3 = mock_factory.create_mock_object_with_str(u"mock_object")
     list_objects = [mock_object1, mock_object2, mock_object3]
     mock_list_convert_to_byte_string_utf8.return_value = [b"mock_object", b"mock_object", b"mock_object"]
     result = self.object_converter.list_convert_to_string(list_objects)
     self.assertEquals(result, [b"mock_object", b"mock_object", b"mock_object"])
Esempio n. 2
0
 def test_list_convert_to_byte_string_utf8(self, mock_convert_to_byte_string_utf8):
     mock_object1 = mock_factory.create_mock_object_with_str("mock_object")
     mock_object2 = mock_factory.create_mock_object_with_str(b"mock_object")
     mock_object3 = mock_factory.create_mock_object_with_str(u"mock_object")
     list_objects = [mock_object1, mock_object2, mock_object3]
     mock_convert_to_byte_string_utf8.return_value = b"mock_object"
     result = self.object_converter.list_convert_to_byte_string_utf8(list_objects)
     self.assertEquals(result, [b"mock_object", b"mock_object", b"mock_object"])
Esempio n. 3
0
 def test_list_convert_to_unicode_string(self, mock_convert_to_string):
     mock_object1 = mock_factory.create_mock_object_with_str("mock_object")
     mock_object2 = mock_factory.create_mock_object_with_str(b"mock_object")
     mock_object3 = mock_factory.create_mock_object_with_str(u"mock_object")
     list_objects = [mock_object1, mock_object2, mock_object3]
     mock_convert_to_string.return_value = "mock_object"
     result = self.object_converter.list_convert_to_string(list_objects)
     self.assertEquals(result, ["mock_object", "mock_object", "mock_object"])
 def test_convert_to_string_argument_object(self):
     mock_object = mock_factory.create_mock_object_with_str("mock_object")
     self.object_converter.instance_resolver.is_unicode_string.return_value = False
     result = self.object_converter.convert_to_string(mock_object)
     self.assertEquals(result, "mock_object")
Esempio n. 5
0
 def test_convert_to_string_argument_object(self):
     mock_object = mock_factory.create_mock_object_with_str("mock_object")
     self.object_converter.instance_resolver.is_string_python_version.return_value = False
     result = self.object_converter.convert_to_string(mock_object)
     self.assertEquals(result, "mock_object")