Added the missing files
This commit is contained in:
parent
129d56611c
commit
6c907a7cbb
15
novaclient/accounts.py
Normal file
15
novaclient/accounts.py
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
from novaclient import base
|
||||||
|
|
||||||
|
class Account(base.Resource):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class AccountManager(base.BootingManagerWithFind):
|
||||||
|
resource_class = Account
|
||||||
|
|
||||||
|
def create_instance_for(self, account_id, name, image, flavor,
|
||||||
|
ipgroup=None, meta=None, files=None, zone_blob=None,
|
||||||
|
reservation_id=None):
|
||||||
|
resource_url = "/accounts/%s/create_instance" % account_id
|
||||||
|
return self._boot(resource_url, "server", name, image, flavor,
|
||||||
|
ipgroup=ipgroup, meta=meta, files=files,
|
||||||
|
zone_blob=zone_blob, reservation_id=reservation_id)
|
22
tests/test_accounts.py
Normal file
22
tests/test_accounts.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import StringIO
|
||||||
|
|
||||||
|
from nose.tools import assert_equal
|
||||||
|
|
||||||
|
from fakeserver import FakeServer
|
||||||
|
from novaclient import Account
|
||||||
|
|
||||||
|
cs = FakeServer()
|
||||||
|
|
||||||
|
def test_instance_creation_for_account():
|
||||||
|
s = cs.accounts.create_instance_for(
|
||||||
|
account_id='test_account',
|
||||||
|
name="My server",
|
||||||
|
image=1,
|
||||||
|
flavor=1,
|
||||||
|
meta={'foo': 'bar'},
|
||||||
|
ipgroup=1,
|
||||||
|
files={
|
||||||
|
'/etc/passwd': 'some data', # a file
|
||||||
|
'/tmp/foo.txt': StringIO.StringIO('data') # a stream
|
||||||
|
})
|
||||||
|
cs.assert_called('POST', '/accounts/test_account/create_instance')
|
Loading…
x
Reference in New Issue
Block a user