Revision 1c636ad6

b/snf-cyclades-app/synnefo/tools/burnin.py
53 53
from multiprocessing import Process, Queue
54 54
from random import choice
55 55

  
56
from kamaki.client import Client, ClientError
56
from kamaki.clients import ClientError, ComputeClient, CycladesClient
57
from kamaki.config import Config
58

  
57 59
from vncauthproxy.d3des import generate_response as d3des_generate_response
58 60

  
59 61
# Use backported unittest functionality if Python < 2.7
......
83 85
class UnauthorizedTestCase(unittest.TestCase):
84 86
    def test_unauthorized_access(self):
85 87
        """Test access without a valid token fails"""
86
        c = Client(API, "123")
88
        falseToken = '12345'
89
        conf = Config()
90
        conf.set('compute_token', falseToken)
91

  
87 92
        with self.assertRaises(ClientError) as cm:
88 93
            c.list_servers()
89 94
        self.assertEqual(cm.exception.status, 401)
......
95 100
    def setUpClass(cls):
96 101
        """Initialize kamaki, get (detailed) list of images"""
97 102
        log.info("Getting simple and detailed list of images")
98
        cls.client = Client(API, TOKEN)
103

  
104
        conf = Config()
105
        conf.set('compute_token', TOKEN)
106
        cls.client = ComputeClient(conf)
99 107
        cls.images = cls.client.list_images()
100 108
        cls.dimages = cls.client.list_images(detail=True)
101 109

  
......
120 128

  
121 129
    def test_005_image_metadata(self):
122 130
        """Test every image has specific metadata defined"""
123
        keys = frozenset(["OS", "description", "size"])
131
        keys = frozenset(["os", "description", "size"])
124 132
        for i in self.dimages:
125 133
            self.assertTrue(keys.issubset(i["metadata"]["values"].keys()))
126 134

  
......
131 139
    def setUpClass(cls):
132 140
        """Initialize kamaki, get (detailed) list of flavors"""
133 141
        log.info("Getting simple and detailed list of flavors")
134
        cls.client = Client(API, TOKEN)
142

  
143
        conf = Config()
144
        conf.set('compute_token', TOKEN)
145
        cls.client = ComputeClient(conf)
135 146
        cls.flavors = cls.client.list_flavors()
136 147
        cls.dflavors = cls.client.list_flavors(detail=True)
137 148

  
......
172 183
    def setUpClass(cls):
173 184
        """Initialize kamaki, get (detailed) list of servers"""
174 185
        log.info("Getting simple and detailed list of servers")
175
        cls.client = Client(API, TOKEN)
186

  
187
        conf = Config()
188
        conf.set('compute_token', TOKEN)
189
        cls.client = ComputeClient(conf)
176 190
        cls.servers = cls.client.list_servers()
177 191
        cls.dservers = cls.client.list_servers(detail=True)
178 192

  
......
199 213
    def setUpClass(cls):
200 214
        """Initialize a kamaki instance"""
201 215
        log.info("Spawning server for image `%s'", cls.imagename)
202
        cls.client = Client(API, TOKEN)
216

  
217
        conf = Config()
218
        conf.set('compute_token', TOKEN)
219
        cls.client = ComputeClient(conf)
203 220

  
204 221
    def _get_ipv4(self, server):
205 222
        """Get the public IPv4 of a server from the detailed server info"""
223

  
224
        details = 
206 225
        public_addrs = filter(lambda x: x["id"] == "public",
207 226
                              server["addresses"]["values"])
208 227
        self.assertEqual(len(public_addrs), 1)
......
223 242

  
224 243
    def _connect_loginname(self, os):
225 244
        """Return the login name for connections based on the server OS"""
226
        if os in ("ubuntu", "kubuntu", "fedora"):
245
        if os in ("Ubuntu", "Kubuntu", "Fedora"):
227 246
            return "user"
228
        elif os == "windows":
247
        elif os in ("windows", "windows_alpha1"):
229 248
            return "Administrator"
230 249
        else:
231 250
            return "root"

Also available in: Unified diff