~ubuntuone-hackers/click-toolbelt/trunk

« back to all changes in this revision

Viewing changes to storeapi/tests/test_channels.py

[r=matiasb,fgallina] split store api into standalone namespace for easier vendoring

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
# GNU General Public License version 3 (see the file LICENSE).
4
4
from __future__ import absolute_import, unicode_literals
5
5
import json
 
6
from unittest import TestCase
6
7
 
7
8
from mock import patch
8
9
 
9
 
from click_toolbelt.api.channels import get_channels, update_channels
10
 
from click_toolbelt.tests.test_config import ConfigTestCase
11
 
 
12
 
 
13
 
class ChannelsAPITestCase(ConfigTestCase):
 
10
from storeapi.channels import get_channels, update_channels
 
11
 
 
12
 
 
13
class ChannelsAPITestCase(TestCase):
14
14
 
15
15
    def setUp(self):
16
16
        super(ChannelsAPITestCase, self).setUp()
17
17
 
18
18
        # setup patches
19
 
        oauth_session = 'click_toolbelt.api.common.get_oauth_session'
 
19
        oauth_session = 'storeapi.common.get_oauth_session'
20
20
        patcher = patch(oauth_session)
21
21
        self.mock_get_oauth_session = patcher.start()
22
22
        self.mock_session = self.mock_get_oauth_session.return_value
87
87
        self.assertEqual(data, expected)
88
88
 
89
89
    def test_get_channels_uses_environment_variables(self):
90
 
        with patch('click_toolbelt.api.common.os.environ',
 
90
        with patch('storeapi.common.os.environ',
91
91
                   {'MYAPPS_API_ROOT_URL': 'http://example.com'}):
92
92
            get_channels(self.mock_session, 'package.name')
93
93
        self.mock_get.assert_called_once_with(
135
135
        self.assertEqual(data, expected)
136
136
 
137
137
    def test_update_channels_uses_environment_variables(self):
138
 
        with patch('click_toolbelt.api.common.os.environ',
 
138
        with patch('storeapi.common.os.environ',
139
139
                   {'MYAPPS_API_ROOT_URL': 'http://example.com'}):
140
140
            update_channels(
141
141
                self.mock_session, 'package.name', {'stable': 2})