def test_do_update_dry_run_false(self):
        class Image():
            fields = ['id=test_updated',
                      'status=active',
                      'is_public=True',
                      'name=new_name',
                      'protected=False',
                      'is_public=True']
            dry_run = False
            id = 'test'
            verbose = True
            is_public = True
            protected = False
            status = 'active'
            size = 1024
            min_ram = 512
            min_disk = 512
            properties = {'property': 'test'}
            created_at = '12.09.2013'

        args = Image()
        gc = client.Client('1', 'http://is.invalid')
        with mock.patch.object(gc.images, 'update') as mocked_update:
            mocked_update.return_value = Image()
            actual = test_shell.do_update(gc, args)
            self.assertEqual(0, actual)
    def test_do_update_error(self):
        class FakeClient():
            endpoint = 'http://is.invalid'

        class Image():
            fields = ['id', 'is_public', 'name']

        args = Image()
        fake_client = FakeClient()
        actual = test_shell.do_update(fake_client, args)
        self.assertEqual(1, actual)
Exemplo n.º 3
0
    def test_do_update(self):
        class Image():
            fields = [
                'id=test_updated', 'status=active', 'is_public=True',
                'name=new_name', 'protected=False'
            ]
            dry_run = True
            id = 'test'

        args = Image()
        gc = client.Client('1', 'http://is.invalid')
        actual = test_shell.do_update(gc, args)
        self.assertEqual(0, actual)
    def test_do_update(self):
        class Image():
            fields = ['id=test_updated',
                      'status=active',
                      'is_public=True',
                      'name=new_name',
                      'protected=False']
            dry_run = True
            id = 'test'

        args = Image()
        gc = client.Client('1', 'http://is.invalid')
        actual = test_shell.do_update(gc, args)
        self.assertEqual(0, actual)