~ubuntu-branches/ubuntu/trusty/python-keystoneclient/trusty-proposed

« back to all changes in this revision

Viewing changes to tests/test_shell.py

  • Committer: Package Import Robot
  • Author(s): Adam Gandelman
  • Date: 2012-03-16 11:43:56 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20120316114356-ytz88rwfyb21mdmt
Tags: 2012.1~rc1~20120310.0-0ubuntu1
* New upstream release.
* debian/watch: Add watch file 

Show diffs side-by-side

added added

removed removed

Lines of Context:
175
175
                        do_shell_mock):
176
176
            shell('ec2-credentials-delete')
177
177
            assert do_shell_mock.called
 
178
 
 
179
    def test_do_endpoints(self):
 
180
        do_shell_mock = mock.MagicMock()
 
181
        # grab the decorators for do_endpoint_create
 
182
        shell_func = getattr(shell_v2_0, 'do_endpoint_create')
 
183
        do_shell_mock.arguments = getattr(shell_func, 'arguments', [])
 
184
        with mock.patch('keystoneclient.v2_0.shell.do_endpoint_create',
 
185
                        do_shell_mock):
 
186
 
 
187
            # Test create args
 
188
            shell('endpoint-create '
 
189
                  '--service_id=2 --publicurl=http://example.com:1234/go '
 
190
                  '--adminurl=http://example.com:9876/adm')
 
191
            assert do_shell_mock.called
 
192
            ((a, b), c) = do_shell_mock.call_args
 
193
            assert (b.auth_url, b.password, b.os_tenant_id,
 
194
                    b.tenant_name, b.username, b.identity_api_version) == \
 
195
                   (DEFAULT_AUTH_URL, DEFAULT_PASSWORD, DEFAULT_TENANT_ID,
 
196
                    DEFAULT_TENANT_NAME, DEFAULT_USERNAME, '')
 
197
            assert (b.service_id, b.publicurl, b.adminurl) == ('2',
 
198
                    'http://example.com:1234/go',
 
199
                    'http://example.com:9876/adm')