Ejemplo n.º 1
0
 def test_render_widget_with_value(self):
     widget = CommaSeparatedUserInput()
     input_name = 'recipient'
     input_value = 'username'
     html = widget.render(input_name, input_value, {'extra_attribute':'extra_value'})
     expected_html = u'<input extra_attribute="extra_value" '
     expected_html += u'type="text" name="recipient" value="username" />'
     self.assertEquals(expected_html, html)
Ejemplo n.º 2
0
 def test_render_widget_with_tuple_with_one_object(self):
     mock_user = MockUserObject(username='******')
     widget = CommaSeparatedUserInput()
     input_name = 'recipient'
     input_value = (mock_user,)
     html = widget.render(input_name, input_value, {'extra_attribute':'extra_value'})
     expected_html = u'<input extra_attribute="extra_value" '
     expected_html += u'type="text" name="recipient" value="username_mock_user" />'
     self.assertEquals(expected_html, html)
Ejemplo n.º 3
0
 def test_render_widget_with_list_with_several_object(self):
     mock_user1 = MockUserObject(username='******')
     mock_user2 = MockUserObject(username='******')
     widget = CommaSeparatedUserInput()
     input_name = 'recipient'
     input_value = [mock_user1, mock_user2]
     html = widget.render(input_name, input_value, {'extra_attribute':'extra_value'})
     expected_html = u'<input extra_attribute="extra_value" '
     expected_html += u'type="text" name="recipient" '
     expected_html += u'value="username_mock_user_1, username_mock_user_2" />'
     self.assertEquals(expected_html, html)