def test_apply_vm_profiles_config_success(self): ''' Tests passing in valid provider and profile config files successfully ''' providers = { 'test-provider': { 'digital_ocean': { 'provider': 'digital_ocean', 'profiles': {} } } } overrides = { 'test-profile': { 'provider': 'test-provider', 'image': 'Ubuntu 12.10 x64', 'size': '512MB' }, 'conf_file': PATH } ret = { 'test-profile': { 'profile': 'test-profile', 'provider': 'test-provider:digital_ocean', 'image': 'Ubuntu 12.10 x64', 'size': '512MB' } } self.assertEqual( sconfig.apply_vm_profiles_config(providers, overrides, defaults=DEFAULT), ret)
def test_apply_vm_profiles_config_extend_success(self): ''' Tests profile extends functionality with valid provider and profile configs ''' providers = {'test-config': {'ec2': {'profiles': {}, 'provider': 'ec2'}}} overrides = {'Amazon': {'image': 'test-image-1', 'extends': 'dev-instances'}, 'Fedora': {'image': 'test-image-2', 'extends': 'dev-instances'}, 'conf_file': PATH, 'dev-instances': {'ssh_username': '******', 'provider': 'test-config'}} ret = {'Amazon': {'profile': 'Amazon', 'ssh_username': '******', 'image': 'test-image-1', 'provider': 'test-config:ec2'}, 'Fedora': {'profile': 'Fedora', 'ssh_username': '******', 'image': 'test-image-2', 'provider': 'test-config:ec2'}, 'dev-instances': {'profile': 'dev-instances', 'ssh_username': '******', 'provider': 'test-config:ec2'}} self.assertEqual(sconfig.apply_vm_profiles_config(providers, overrides, defaults=DEFAULT), ret)
def test_apply_vm_profiles_config_extend_success(self): ''' Tests profile extends functionality with valid provider and profile configs ''' providers = {'test-config': {'ec2': {'profiles': {}, 'driver': 'ec2'}}} overrides = {'Amazon': {'image': 'test-image-1', 'extends': 'dev-instances'}, 'Fedora': {'image': 'test-image-2', 'extends': 'dev-instances'}, 'conf_file': PATH, 'dev-instances': {'ssh_username': '******', 'provider': 'test-config'}} ret = {'Amazon': {'profile': 'Amazon', 'ssh_username': '******', 'image': 'test-image-1', 'provider': 'test-config:ec2'}, 'Fedora': {'profile': 'Fedora', 'ssh_username': '******', 'image': 'test-image-2', 'provider': 'test-config:ec2'}, 'dev-instances': {'profile': 'dev-instances', 'ssh_username': '******', 'provider': 'test-config:ec2'}} self.assertEqual(sconfig.apply_vm_profiles_config(providers, overrides, defaults=DEFAULT), ret)
def test_apply_vm_profiles_config_extend_override_success(self): ''' Tests profile extends and recursively merges data elements ''' self.maxDiff = None providers = {'test-config': {'ec2': {'profiles': {}, 'driver': 'ec2'}}} overrides = {'Fedora': {'image': 'test-image-2', 'extends': 'dev-instances', 'minion': {'grains': {'stage': 'experimental'}}}, 'conf_file': PATH, 'dev-instances': {'ssh_username': '******', 'provider': 'test-config', 'minion': {'grains': {'role': 'webserver'}}}} ret = {'Fedora': {'profile': 'Fedora', 'ssh_username': '******', 'image': 'test-image-2', 'minion': {'grains': {'role': 'webserver', 'stage': 'experimental'}}, 'provider': 'test-config:ec2'}, 'dev-instances': {'profile': 'dev-instances', 'ssh_username': '******', 'minion': {'grains': {'role': 'webserver'}}, 'provider': 'test-config:ec2'}} self.assertEqual(sconfig.apply_vm_profiles_config(providers, overrides, defaults=DEFAULT), ret)
def test_apply_vm_profiles_config_success(self): ''' Tests passing in valid provider and profile config files successfully ''' providers = {'test-provider': {'digital_ocean': {'driver': 'digital_ocean', 'profiles': {}}}} overrides = {'test-profile': {'provider': 'test-provider', 'image': 'Ubuntu 12.10 x64', 'size': '512MB'}, 'conf_file': PATH} ret = {'test-profile': {'profile': 'test-profile', 'provider': 'test-provider:digital_ocean', 'image': 'Ubuntu 12.10 x64', 'size': '512MB'}} self.assertEqual(sconfig.apply_vm_profiles_config(providers, overrides, defaults=DEFAULT), ret)