Commit 3b4454e2 authored by Łukasz Nowak's avatar Łukasz Nowak

Checkpoint: allocation of instance on friend computer.

parent fda45c50
...@@ -200,6 +200,46 @@ class TestSlapOSDefaultScenario(TestSlapOSSecurityMixin): ...@@ -200,6 +200,46 @@ class TestSlapOSDefaultScenario(TestSlapOSSecurityMixin):
self.assertEqual('SoftwareInstance', software_instance.__class__.__name__) self.assertEqual('SoftwareInstance', software_instance.__class__.__name__)
return software_instance return software_instance
def checkInstanceAllocation(self, person_reference, instance_title,
software_release, software_type, server):
self.login(person_reference)
self.personRequestInstanceNotReady(
software_release=software_release,
software_type=software_type,
partition_reference=instance_title,
)
self.stepCallSlaposAllocateInstanceAlarm()
self.tic()
self.personRequestInstance(
software_release=software_release,
software_type=software_type,
partition_reference=instance_title,
)
# now instantiate it on computer and set some nice connection dict
self.simulateSlapgridCP(server)
# let's find instances of user and check connection strings
hosting_subscription_list = self.\
WebSection_getCurrentHostingSubscriptionList()
self.assertEqual(1, len(hosting_subscription_list))
hosting_subscription = hosting_subscription_list[0].getObject()
software_instance = hosting_subscription.getPredecessorValue()
self.assertEqual(software_instance.getTitle(),
hosting_subscription.getTitle())
connection_dict = software_instance.getConnectionXmlAsDict()
self.assertSameSet(('url_1', 'url_2'), connection_dict.keys())
self.login()
partition = software_instance.getAggregateValue()
self.assertSameSet(
['http://%s/' % q.getIpAddress() for q in
partition.contentValues(portal_type='Internet Protocol Address')],
connection_dict.values())
def test(self): def test(self):
# some preparation # some preparation
self.logout() self.logout()
...@@ -248,49 +288,33 @@ class TestSlapOSDefaultScenario(TestSlapOSSecurityMixin): ...@@ -248,49 +288,33 @@ class TestSlapOSDefaultScenario(TestSlapOSSecurityMixin):
self.formatComputer(personal_server) self.formatComputer(personal_server)
self.formatComputer(friend_server) self.formatComputer(friend_server)
# now join as the another visitor and request software instance # join as the another visitor and request software instance on public
# on public computer # computer
self.logout() self.logout()
public_reference = 'public-%s' % self.generateNewId() public_reference = 'public-%s' % self.generateNewId()
self.joinSlapOS(self.web_site, public_reference) self.joinSlapOS(self.web_site, public_reference)
self.login(public_reference)
public_instance_title = 'Public title %s' % self.generateNewId() public_instance_title = 'Public title %s' % self.generateNewId()
self.personRequestInstanceNotReady( self.checkInstanceAllocation(public_reference, public_instance_title,
software_release=public_server_software, public_server_software, 'public type', public_server)
software_type='public type',
partition_reference=public_instance_title,
)
self.stepCallSlaposAllocateInstanceAlarm() # join as owner friend and request a software instance on computer
self.tic() # configured by owner
self.personRequestInstance(
software_release=public_server_software,
software_type='public type',
partition_reference=public_instance_title,
)
# now instantiate it on computer and set some nice connection dict self.logout()
self.simulateSlapgridCP(public_server) friend_reference = 'friend-%s' % self.generateNewId()
self.joinSlapOS(self.web_site, friend_reference)
self.login()
friend_email = self.portal.portal_catalog.getResultValue(
portal_type='Person', reference=friend_reference).getDefaultEmailText()
# let's find instances of user and check connection strings # allow friend to alloce on friendly computer
hosting_subscription_list = self.\ self.login(owner_reference)
WebSection_getCurrentHostingSubscriptionList() self.setServerOpenFriend(friend_server, [friend_email])
self.assertEqual(1, len(hosting_subscription_list))
hosting_subscription = hosting_subscription_list[0].getObject()
software_instance = hosting_subscription.getPredecessorValue() friend_instance_title = 'Friend title %s' % self.generateNewId()
self.assertEqual(software_instance.getTitle(), self.checkInstanceAllocation(friend_reference, friend_instance_title,
hosting_subscription.getTitle()) friend_server_software, 'friend_type', friend_server)
connection_dict = software_instance.getConnectionXmlAsDict()
self.assertSameSet(('url_1', 'url_2'), connection_dict.keys())
self.login()
partition = software_instance.getAggregateValue()
self.assertSameSet(
['http://%s/' % q.getIpAddress() for q in
partition.contentValues(portal_type='Internet Protocol Address')],
connection_dict.values())
# remove the assertion after test is finished # remove the assertion after test is finished
self.assertTrue(False, 'Test not finished') self.assertTrue(False, 'Test not finished')
71 72
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment