/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz
737.1.3 by Curtis Hovey
Added basic tests to verify __eq__ is fixed.
1
# Copyright (C) 2011 Curtis Hovey <sinzui.is@verizon.net>
2
#
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
7
#
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
12
#
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
17
"""Test the AvatarsBox functionality."""
18
19
from bzrlib import (
20
    tests,
21
    )
22
23
from bzrlib.plugins.gtk.avatarsbox import Avatar
24
25
26
class TestAvatar(tests.TestCase):
27
28
    def test__init(self):
29
        apparent_username = 'Random J User <randomjuser@eg.dom>'
30
        avatar = Avatar(apparent_username)
31
        self.assertEqual(apparent_username, avatar.apparent_username)
32
        self.assertEqual('Random J User', avatar.username)
33
        self.assertEqual('randomjuser@eg.dom', avatar.email)
34
        self.assertEqual(None, avatar.image)
35
36
    def test_eq_true(self):
37
        apparent_username = 'Random J User <randomjuser@eg.dom>'
38
        avatar_1 = Avatar(apparent_username)
39
        avatar_2 = Avatar(apparent_username)
40
        self.assertTrue(avatar_1 == avatar_2)
41
42
    def test_eq_false(self):
43
        apparent_username = 'Random J User <randomjuser@eg.dom>'
44
        avatar_1 = Avatar(apparent_username)
45
        avatar_2 = Avatar(apparent_username)
46
        avatar_2.username = 'changed'
47
        self.assertFalse(avatar_1 == avatar_2)