Exemplo n.º 1
0
    def test_clout_person(self):
        # TODO: mock follow() method since that is not what we are testing.
        clout = Clout()
        clout.follow('nancy', 'sid')
        clout_string = clout.clout('sid')
        expected_clout_string = "sid has 1 follower(s).\n"

        self.assertEqual(clout_string, expected_clout_string)
Exemplo n.º 2
0
    def test_clout_person(self):
        # TODO: mock follow() method since that is not what we are testing.
        clout = Clout()
        clout.follow('nancy', 'sid')
        clout_string = clout.clout('sid')
        expected_clout_string = "sid has 1 follower(s).\n"

        self.assertEqual(clout_string, expected_clout_string)
Exemplo n.º 3
0
    def test_follow_follows_self(self):
        clout = Clout()
        follows = clout.follow('nancy', 'nancy')

        self.assertFalse(follows)
        self.assertEqual(clout.get_person_by_name('nancy').score, 0)
Exemplo n.º 4
0
    def test_follow(self):
        clout = Clout()
        clout.follow('nancy', 'sid')

        self.assertEqual(clout.get_person_by_name('sid').score, 1)
        self.assertEqual(clout.get_person_by_name('nancy').score, 0)
Exemplo n.º 5
0
    def test_follow_from_example(self):
        clout = Clout()
        clout.follow('neymar', 'xavi')
        # neymar = 0, xavi = 1
        clout.follow('neymar', 'messi')
        # neymar = 0, xavi = 0, messi = 1
        clout.follow('messi', 'messi')
        # neymar = 0, xavi = 0, messi = 1
        clout.follow('pique', 'victor')
        # neymar = 0, xavi = 0, messi = 1, pique = 0, victor = 1
        clout.follow('jordi', 'pique')
        # neymar = 0, xavi = 0, messi = 1, pique = 1, victor = 2, jordi = 0
        clout.follow('messi', 'victor')
        # neymar = 0, xavi = 0, messi = 1, pique = 0, victor = 4, jordi = 0

        self.assertEqual(clout.get_person_by_name('victor').score, 4)
        self.assertEqual(clout.get_person_by_name('messi').score, 1)
        self.assertEqual(clout.get_person_by_name('pique').score, 1)
        self.assertEqual(clout.get_person_by_name('jordi').score, 0)
        self.assertEqual(clout.get_person_by_name('neymar').score, 0)
        self.assertEqual(clout.get_person_by_name('xavi').score, 0)
Exemplo n.º 6
0
    def test_follow_from_example(self):
        clout = Clout()
        clout.follow('neymar', 'xavi')
        # neymar = 0, xavi = 1
        clout.follow('neymar', 'messi')
        # neymar = 0, xavi = 0, messi = 1
        clout.follow('messi', 'messi')
        # neymar = 0, xavi = 0, messi = 1
        clout.follow('pique', 'victor')
        # neymar = 0, xavi = 0, messi = 1, pique = 0, victor = 1
        clout.follow('jordi', 'pique')
        # neymar = 0, xavi = 0, messi = 1, pique = 1, victor = 2, jordi = 0
        clout.follow('messi', 'victor')
        # neymar = 0, xavi = 0, messi = 1, pique = 0, victor = 4, jordi = 0

        self.assertEqual(clout.get_person_by_name('victor').score, 4)
        self.assertEqual(clout.get_person_by_name('messi').score, 1)
        self.assertEqual(clout.get_person_by_name('pique').score, 1)
        self.assertEqual(clout.get_person_by_name('jordi').score, 0)
        self.assertEqual(clout.get_person_by_name('neymar').score, 0)
        self.assertEqual(clout.get_person_by_name('xavi').score, 0)
Exemplo n.º 7
0
    def test_follow_follows_self(self):
        clout = Clout()
        follows = clout.follow('nancy', 'nancy')

        self.assertFalse(follows)
        self.assertEqual(clout.get_person_by_name('nancy').score, 0)
Exemplo n.º 8
0
    def test_follow(self):
        clout = Clout()
        clout.follow('nancy', 'sid')

        self.assertEqual(clout.get_person_by_name('sid').score, 1)
        self.assertEqual(clout.get_person_by_name('nancy').score, 0)