~paolorotolo/software-center/fix-for-963309

« back to all changes in this revision

Viewing changes to test/test_scagent.py

  • Committer: Danny Tamez
  • Date: 2012-01-19 16:17:34 UTC
  • mfrom: (2682 trunk)
  • mto: This revision was merged to the branch mainline in revision 2683.
  • Revision ID: danny.tamez@canonical.com-20120119161734-8viwvv83ph9d4kfx
MergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/python
2
2
 
3
3
from gi.repository import GObject
 
4
from mock import patch
4
5
import unittest
5
6
 
6
7
from testutils import setup_test_env
31
32
        self.loop.run()        
32
33
        self.assertFalse(self.error)
33
34
 
34
 
    # disabled for now as this is not yet on staging or production
35
 
    def disabled_test_scagent_query_exhibits(self):
 
35
    def test_scagent_query_exhibits(self):
36
36
        sca = SoftwareCenterAgent()
37
37
        sca.connect("exhibits", self.on_query_done)
38
38
        sca.connect("error", self.on_query_error)
40
40
        self.loop.run()  
41
41
        self.assertFalse(self.error)
42
42
 
 
43
    def test_scaagent_query_available_for_me_uses_complete_only(self):
 
44
        run_generic_piston_helper_fn = (
 
45
            'softwarecenter.backend.spawn_helper.SpawnHelper.'
 
46
            'run_generic_piston_helper')
 
47
        with patch(run_generic_piston_helper_fn) as mock_run_piston_helper:
 
48
            sca = SoftwareCenterAgent()
 
49
            sca.query_available_for_me()
 
50
 
 
51
            mock_run_piston_helper.assert_called_with(
 
52
                'SoftwareCenterAgentAPI', 'subscriptions_for_me',
 
53
                complete_only=True)
 
54
 
43
55
 
44
56
if __name__ == "__main__":
45
57
    import logging