~mvo/software-center/fix-index-update-terms-bug

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import unittest

from mock import patch

from tests.utils import (
    setup_test_env,
)
setup_test_env()
from softwarecenter.backend.spawn_helper import SpawnHelper


class TestSpawnHelper(unittest.TestCase):

    def test_spawn_helper_lp957599(self):
        days_delta = 6
        spawn_helper = SpawnHelper()
        with patch.object(spawn_helper, "run") as mock_run:
            spawn_helper.run_generic_piston_helper(
                "RatingsAndReviewsAPI", "review_stats", days=days_delta)
            cmd = mock_run.call_args[0][0]
            #print mock_run.call_args_list
            #print cmd
            self.assertEqual(cmd[3], 'RatingsAndReviewsAPI')
            self.assertEqual(cmd[4], 'review_stats')
            self.assertEqual(cmd[5], '{"days": 6}')



if __name__ == "__main__":
    unittest.main()