def __init__(self, db): ''' General description : This function initializes the database variables and \ index to refer in functions. ''' self.db = db self.configdb = Config.Config(db) self.toolDB = Tool.Tool(self.db) self.userDB = Users.Users(self.db) self.roleDB = Role.Role(self.db) self.buildsDB = Build.Build() self.versionsDB = Versions.Versions(db) self.emailsDB = Emails.Emails(self.db) self.deploymentRequestDB = DeploymentRequest.DeploymentRequest(db) self.CloneRequestDB = CloneRequest.CloneRequest(db) self.contributionGitPushLogs = ContributionGitPushLogs.ContributionGitPushLogs( db) self.sync = Sync.Sync(db) self.auditingDB = Auditing.Auditing() self.distributionSync = DistributionSync.DistributionSync(db) self.mediaFilesDB = MediaFiles.MediaFiles(self.db) self.logo_path = logo_path self.full_logo_path = str(current_path) + self.logo_path self.media_files_path = media_path self.full_media_files_path = media_full_path self.folder_list_to_clean = [ export_full_path, distribution_center_export_full_path ] self.config_id = 15 self.load_configuration() self.schedulerService = SchedulerService.SchedulerService() self.deploymentUnitDB = DeploymentUnit.DeploymentUnit() self.repositoryDB = Repository.Repository()
def __init__(self): self.versionsDB = Versions.Versions(mongodb) self.toolDB = Tool.Tool(mongodb) self.tagDB = Tags.Tags() self.toolsetdb = ToolSet.ToolSet(mongodb) self.deploymentunitsetdb = DeploymentUnitSet.DeploymentUnitSet() self.deploymentunitdb = DeploymentUnit.DeploymentUnit() self.teamDB = Teams.Teams(mongodb) self.machineDB = Machine.Machine(mongodb) self.machinegroupsDB = MachineGroups.MachineGroups(mongodb) self.toolsetdb = ToolSet.ToolSet(mongodb) self.userdb = Users.Users(mongodb) self.roledb = Role.Role(mongodb)
def __init__(self): self.db = mongodb self.current_import_path = import_full_path if self.current_import_path in [None, ""]: raise ValueError("Import path was not provided") if not os.path.exists(self.current_import_path): os.makedirs(self.current_import_path) if not os.access(os.path.dirname(self.current_import_path), os.W_OK): raise ValueError("The directory does not have write access :" + self.current_import_path) self.current_export_path = export_full_path if self.current_export_path in [None, ""]: raise ValueError("Export path was not provided") if not os.path.exists(self.current_export_path): os.makedirs(self.current_export_path) if not os.access(os.path.dirname(self.current_export_path), os.W_OK): raise ValueError("The directory does not have write access :" + self.current_export_path) self.configdb = Config.Config(self.db) self.versionsDB = Versions.Versions(self.db) self.toolDB = Tool.Tool(self.db) self.deploymentFieldsDB = DeploymentFields.DeploymentFields(self.db) self.machineDB = Machine.Machine(self.db) self.syncDb = Sync.Sync(self.db) self.mailer = Mailer.Mailer() self.syncRequestDb = SyncRequest.SyncRequest(self.db) self.buildsDB = Build.Build() self.documentsDB = Documents.Documents(self.db) self.toolDB = Tool.Tool(self.db) self.deploymentunitDB = DeploymentUnit.DeploymentUnit() self.deploymentunitsetDB = DeploymentUnitSet.DeploymentUnitSet() self.mediaFilesDB = MediaFiles.MediaFiles(self.db) self.tagsDB = Tags.Tags() self.preRequisitesDB = PreRequisites.PreRequisites(self.db) self.logo_path = logo_path self.full_logo_path = logo_full_path self.media_files_path = media_path self.full_media_files_path = media_full_path self.systemDetailsDb = SystemDetails.SystemDetails(self.db) self.systemDetail = self.systemDetailsDb.get_system_details_single() self.statedb = State.State(self.db) if not self.systemDetail: raise Exception("systemDeatils not found") self.config_id = 9 self.load_configuration() self.schedulerService = SchedulerService.SchedulerService() self.flexAttrDB = FlexibleAttributes.FlexibleAttributes()
from DBUtil import State, DeploymentUnitApprovalStatus, DeploymentFields, DeploymentUnit, DeploymentUnitSet, Build from Services import HelperServices, StateHelperService from Services.AppInitServices import authService from settings import mongodb, relative_path # blueprint declaration stateAPI = Blueprint('stateAPI', __name__) # get global db connection db = mongodb # collection statedb = State.State(db) deploymentUnitApprovalStatusdb = DeploymentUnitApprovalStatus.DeploymentUnitApprovalStatus( ) deploymentFieldsdb = DeploymentFields.DeploymentFields(db) deploymentUnitdb = DeploymentUnit.DeploymentUnit() deploymentUnitSetdb = DeploymentUnitSet.DeploymentUnitSet() buildDB = Build.Build() ''' { "data": { "page_total": 2, "total": 2, "data": [ { "build_id": "59fae88cf6a8881077056569", "name": "Test 100 State-539", "parent_entity_id": "59fac998721561006abadb9b", "parent_entity_name": "Test 100", "_id": { "$oid": "5a3b9b16f913e73f0852811c"
import unittest import requests from GetAuthToken import getToken import json from settings import mongodb, unittest_test_url from DBUtil import DeploymentUnit, DeploymentUnitSet import verifyResponse DeploymentUnitDb = DeploymentUnit.DeploymentUnit() DeploymentUnitSetDb = DeploymentUnitSet.DeploymentUnitSet() Baseurl = unittest_test_url + "deploymentunitset/" header = {'content-type': "application/json", 'token': str(getToken())} class AddDuSetTest(unittest.TestCase): DuSetoid = None Duoid1 = None Duoid2 = None def runTest(self): CreateDuForDuSet() url = Baseurl + "new" print "--------------------------------------------------------------------------------------------------------" print "Calling API :" + url + " For Create DuSet test" payload = { "du_set": [{ "du_id": AddDuSetTest.Duoid1, "dependent": "false",
from modules.apimodels import DeploymentUnitSetModel from modules.apimodels.Restplus import api, header_parser from modules.apimodels.GenericReponseModel import generic_post_response_model, generic_response_model # blueprint declaration deploymentUnitSetAPI = Blueprint('deploymentUnitSetAPI', __name__) deploymentUnitSetAPINs = api.namespace( 'deploymentunitset', description='Deployment Unit Set Operations') # get global db connection db = mongodb deploymentUnitSetDB = DeploymentUnitSet.DeploymentUnitSet() userDB = Users.Users(db) systemDetailsDB = SystemDetails.SystemDetails(db) teamService = TeamService.TeamService() deploymentUnitDB = DeploymentUnit.DeploymentUnit() stateDB = State.State(db) @deploymentUnitSetAPI.route('/deploymentunitset/all', methods=['GET']) @authService.authorized @swag_from(relative_path + '/swgger/DeploymentUnitSetAPI/getAllDeploymentUnitSets.yml') def getAllDeploymentUnitSets(): limit = int(request.args.get('perpage', '30')) page = int(request.args.get('page', "0")) skip = page * limit tags_filter = [] duName_filter = [] approval_status_filter = []