def test_031_add_key(self): """ --> Add Key Send a request to our API to add a new Key. The keys name is the one found in the yaml file in the KEY_NAME: """ print "\n>>>Asking mist.io to generate private key" priv_key = keypairs.generate_keypair(self.uri, cookie=self.cookie) private = priv_key['priv'] seq = range(300) name = self.test_config['KEY_NAME'] + str(random.choice(seq)) print "\n>>>Creating Key with name: %s" % name keypair = keypairs.add_key(self.uri, name, private.strip('\n'), cookie=self.cookie) self.test_config['KEYPAIRS'][keypair['id']] = keypair
def test_035_add_second_key(self): """--->Add second Key""" print "\n>>>Asking mist.io to generate private key" priv_key = keypairs.generate_keypair(self.uri) private = priv_key['priv'] #If the randomly generated key name already exists, generate another one while True: seq = range(300) name = self.test_config['KEY_NAME'] + str(random.choice(seq)) if name not in self.test_config['KEYPAIRS']: break print "\n>>>Creating Second Key with name: %s" % name keypair = keypairs.add_key(self.uri, name, private, cookie=self.cookie) self.test_config['KEYPAIRS'][keypair['id']] = keypair