def test_02_blueprint_create_returns_object(self): '''Story: User attempts to create a blueprint (Blueprint.create) and expects an object in response. ''' from caspyr import Blueprint self.blueprint = Blueprint.create(self.session, project_id='0af2ca6c-aa99-4826-8911-0298a31fc2a4', bp_name='caspyr', description='Blueprint for caspyr tests', version='1', content=('formatVersion: 1\n' 'inputs: {}\n' 'resources:\n' 'Cloud_Machine_1:\n' ' type: Cloud.Machine\n' ' properties:\n' ' image: ubuntu\n' ' flavor: small\n' ) ) self.assertIsInstance(self.blueprint, Blueprint )
def test_01_blueprint_get_returns_list(self): ''' Story: User attempts Blueprint.list(session) and expects a list of blueprints in return. ''' from caspyr import Blueprint self.assertIsInstance(Blueprint.list(self.session), list )
def get_data(): req = request.get_json() token = req['cspapitoken'] s = Session.login(token) serialData = {} deployments = len(Deployment.list(s)) bps = len(Blueprint.list(s)) projects = len(Project.list(s)) cloudaccounts = len(CloudAccount.list(s)) serialData['deployments'] = deployments serialData['bps'] = bps serialData['projects'] = projects serialData['cloudaccounts'] = cloudaccounts return jsonify(serialData)
def test_02_blueprint_describe_returns_object(self): ''' Story: User attempts Blueprint.describe(session) and expects an instance of a Blueprint class to be returned, containing the following attributes: name description tags content valid validationMessages status projectId projectName type id selfLink createdAt createdBy updatedAt updatedBy ''' from caspyr import Blueprint bp = Blueprint.list(self.session)[0] self.blueprint = Blueprint.describe(self.session, bp['id']) self.assertIsInstance(self.blueprint, Blueprint ) self.assertIsInstance(self.blueprint.id, str ) self.assertIsInstance(self.blueprint.name, str ) self.assertIsInstance(self.blueprint.description, str ) self.assertIsInstance(self.blueprint.tags, list ) self.assertIsInstance(self.blueprint.content, str ) self.assertIsInstance(self.blueprint.valid, bool ) self.assertIsInstance(self.blueprint.validation_messages, list ) self.assertIsInstance(self.blueprint.status, str ) self.assertIsInstance(self.blueprint.project_id, str ) self.assertIsInstance(self.blueprint.project_name, str ) self.assertIsInstance(self.blueprint.type, str ) self.assertIsInstance(self.blueprint.id, str ) self.assertIsInstance(self.blueprint.self_link, str ) self.assertIsInstance(self.blueprint.created_at, str ) self.assertIsInstance(self.blueprint.created_by, str ) self.assertIsInstance(self.blueprint.updated_at, str ) self.assertIsInstance(self.blueprint.updated_by, str )