def test_copy_diagram(self, base_url, session): HOSTNAME = os.environ.get('application_hostname') #Get filterKey randomly among the project in the project file filterKey= getRandomFilter(session) diagrams_response = session.get('/rest/dependency-map/1.0/diagram?filterKey=' + filterKey + '&searchTerm=&sortBy=name&reverseSort=&startAt=0&maxResults=50') assert diagrams_response.status_code == 200 result = diagrams_response.json()['values'] if len(result)>0: diagramId=result[0]['id'] #create a copy of the diagram diagrams_response = session.post('/rest/dependency-map/1.0/diagram/duplicate/' + str(diagramId) ) assert diagrams_response.status_code == 200 diagramId = diagrams_response.json()['diagram']['id'] saveRemoveDiagramCmd(diagramId)
def create_data(session): # Get user diagrams_response = session.get('/rest/dependency-map/1.0/user') assert diagrams_response.status_code == 200 userKey = diagrams_response.json()["key"] print_in_shell("User key: " + userKey) # Get filter key diagrams_response = session.get( '/rest/dependency-map/1.0/filter?searchTerm=&page=0&resultsPerPage=25') assert diagrams_response.status_code == 200 # Get field priority diagrams_response = session.get('/rest/dependency-map/1.0/field/priority') assert diagrams_response.status_code == 200 field = diagrams_response.json()["id"] # Get field status diagrams_response = session.get('/rest/dependency-map/1.0/field/status') assert diagrams_response.status_code == 200 field2 = diagrams_response.json()["id"] # Get field fix version diagrams_response = session.get( '/rest/dependency-map/1.0/field/fixVersions') assert diagrams_response.status_code == 200 field3 = diagrams_response.json()["id"] # Get project and filter id from the list of projects we shall use, saved in a file projectId = getRandomProjectId() filterId = getFilterId(projectId) # Create diagram payload = { 'name': "F100", 'author': userKey, 'lastEditedBy': userKey, 'layoutId': 2, 'filterKey': filterId, 'boxColorFieldKey': field, 'groupedLayoutFieldKey': field2, 'matrixLayoutHorizontalFieldKey': field2, 'matrixLayoutVerticalFieldKey': field3 } diagrams_response = session.post('/rest/dependency-map/1.0/diagram', json=payload) assert diagrams_response.status_code == 200 diagramId = diagrams_response.json()['id'] diagramIdStr = str(diagramId) print_in_shell("Nytt diagram med id=" + diagramIdStr) saveRemoveDiagramCmd(diagramIdStr) ############################################################## # Add to favorit ############################################################## #Get favoritDiagram diagrams_response = session.get('/rest/dependency-map/1.0/favoriteDiagram') assert diagrams_response.status_code == 200 favoritDiagrams = diagrams_response.json() #add to favorits favoritDiagrams.insert(0, diagramId) payload = favoritDiagrams diagrams_response = session.post( '/rest/dependency-map/1.0/favoriteDiagram') #Get favoritDiagram diagrams_response = session.get('/rest/dependency-map/1.0/favoriteDiagram') assert diagrams_response.status_code == 200 favoritDiagrams = diagrams_response.json() #update box colore resource entry, created if not exists. payload = { "diagramId": diagramId, "fieldId": "status", "fieldOptionId": 1, "colorPaletteEntryId": 5 } diagrams_response = session.post('/rest/dependency-map/1.0/boxColor', json=payload) assert diagrams_response.status_code == 200 #print_in_shell( diagrams_response.json() ) ####################################################### # Creae linkConfig ####################################################### #Get color palet entrie diagrams_response = session.get( '/rest/dependency-map/1.0/colorPaletteEntry?paletteId=' + '1') assert diagrams_response.status_code == 200 print(diagrams_response.json()) colorPaletteEntryId = diagrams_response.json()[14]["id"] colorPaletteEntryId2 = diagrams_response.json()[10]["id"] colorPaletteEntryId3 = diagrams_response.json()[12]["id"] diagrams_response = session.get('/rest/api/2/issueLinkType') issueLinkTypeIdStr = diagrams_response.json()['issueLinkTypes'][0]['id'] issueLinkTypeId = int(issueLinkTypeIdStr) issueLinkTypeId2Str = diagrams_response.json()['issueLinkTypes'][1]['id'] issueLinkTypeId2 = int(issueLinkTypeId2Str) issueLinkTypeId3Str = diagrams_response.json()['issueLinkTypes'][2]['id'] issueLinkTypeId3 = int(issueLinkTypeId3Str) payload = { 'diagramId': diagramId, 'linkKey': issueLinkTypeId, 'visible': True, 'dashType': 0, 'width': 0, 'colorPaletteEntryId': colorPaletteEntryId } diagrams_response = session.post( '/rest/dependency-map/1.0/linkConfig?diagramId=' + diagramIdStr, json=payload) assert (diagrams_response.status_code == 200) payload = { 'diagramId': diagramId, 'linkKey': issueLinkTypeId2, 'visible': True, 'dashType': 0, 'width': 0, 'colorPaletteEntryId': colorPaletteEntryId2 } diagrams_response = session.post( '/rest/dependency-map/1.0/linkConfig?diagramId=' + diagramIdStr, json=payload) assert (diagrams_response.status_code == 200) payload = { 'diagramId': diagramId, 'linkKey': issueLinkTypeId3, 'visible': True, 'dashType': 0, 'width': 0, 'colorPaletteEntryId': colorPaletteEntryId3 } diagrams_response = session.post( '/rest/dependency-map/1.0/linkConfig?diagramId=' + diagramIdStr, json=payload) assert (diagrams_response.status_code == 200) yield { 'diagramId': diagramId, 'projectId': projectId, 'filterId': filterId } diagrams_response2 = session.delete('/rest/dependency-map/1.0/diagram/' + diagramIdStr) assert diagrams_response2.status_code == 200 print_in_shell("Deleted diagram id=" + diagramIdStr) return { 'diagramId': diagramId, 'projectId': projectId, 'filerId': filterId }
def test_create_change_link(self, base_url, session): # Get project and filter id from the list of projects we shall use, saved in a file projectId = getRandomProjectId() filterId = getFilterId(projectId) # Get user diagrams_response = session.get('/rest/dependency-map/1.0/user') assert diagrams_response.status_code == 200 userKey = diagrams_response.json()["key"] print_in_shell("User key: " + userKey) # Create diagram payload = { 'name': "E100", 'author': userKey, 'lastEditedBy': userKey, 'layoutId': 0, 'filterKey': filterId, 'boxColorFieldKey': "priority", 'groupedLayoutFieldKey': "priority", 'matrixLayoutHorizontalFieldKey': 'fixVersions', 'matrixLayoutVerticalFieldKey': 'fixVersions' } diagrams_response = session.post('/rest/dependency-map/1.0/diagram', json=payload) newDiagram = diagrams_response.json() diagramId = str(newDiagram["id"]) saveRemoveDiagramCmd(diagramId) issueLinkTypeId = get_link_type(session) print(issueLinkTypeId) # Get all link configs #diagrams_response = session.get('/rest/dependency-map/1.0/linkConfig?diagramId=' + diagramId) #print_in_shell("all link configs") #print_in_shell( diagrams_response.json() ) # Create linkConfig payload = { 'diagramId': diagramId, 'linkKey': issueLinkTypeId, 'visible': True, 'dashType': 0, 'width': 0, 'colorPaletteEntryId': 20 } diagrams_response = session.post( '/rest/dependency-map/1.0/linkConfig?diagramId=' + diagramId, json=payload) newLinkConfig = diagrams_response.json() linkConfigId = str(newLinkConfig["id"]) print_in_shell(linkConfigId) assert (diagrams_response.status_code == 200) # Update linkConfig payload = { 'id': linkConfigId, 'diagramId': diagramId, 'linkKey': issueLinkTypeId, 'visible': True, 'dashType': 1, 'width': 2, 'colorPaletteEntryId': 39 } diagrams_response = session.put( '/rest/dependency-map/1.0/linkConfig?diagramId=' + diagramId, json=payload) assert (diagrams_response.status_code == 200) # Get all link configs diagrams_response = session.get( '/rest/dependency-map/1.0/linkConfig?diagramId=' + diagramId) print_in_shell(diagrams_response.json())
def test_create_diagram_flow_cd(self, base_url, session): #JIRA Get list of available link types HOSTNAME = os.environ.get('application_hostname') # Get field priority # diagrams_response = session.get( '/rest/dependency-map/1.0/field/priority') assert diagrams_response.status_code == 200 field = diagrams_response.json()["id"] # Get field option priority # diagrams_response = session.get( '/rest/dependency-map/1.0/fieldOption/priority') assert diagrams_response.status_code == 200 print(diagrams_response.json()) # Get color palette entry# diagrams_response = session.get( '/rest/dependency-map/1.0/colorPaletteEntry?palettId=' + '1') assert diagrams_response.status_code == 200 # Get issue linktype # diagrams_response = session.get('/rest/api/2/issueLinkType') assert diagrams_response.status_code == 200 # Get field # diagrams_response = session.get('/rest/api/2/field') assert diagrams_response.status_code == 200 # Get field # diagrams_response = session.get('/rest/api/2/field') assert diagrams_response.status_code == 200 # Get field fix version # diagrams_response = session.get( '/rest/dependency-map/1.0/field/fixVersions') assert diagrams_response.status_code == 200 field3 = diagrams_response.json()["id"] ############ Give name and select filter # Get filter diagrams_response = session.get( '/rest/dependency-map/1.0/filter?searchTerm=&page=0&resultsPerPage=25' ) assert diagrams_response.status_code == 200 # Get color palette entry# diagrams_response = session.get( '/rest/dependency-map/1.0/colorPaletteEntry?palettId=' + '0') assert diagrams_response.status_code == 200 # Get field priority , repeat this because if some other value was selected such a call had been made# diagrams_response = session.get( '/rest/dependency-map/1.0/field/priority') assert diagrams_response.status_code == 200 field = diagrams_response.json()["id"] # Get field option priority # diagrams_response = session.get( '/rest/dependency-map/1.0/fieldOption/priority') assert diagrams_response.status_code == 200 ############# Select issue color field # Get filter - diagrams_response = session.get( '/rest/dependency-map/1.0/filter?searchTerm=&page=0&resultsPerPage=25' ) assert diagrams_response.status_code == 200 #Get color palet entry diagrams_response = session.get( '/rest/dependency-map/1.0/colorPaletteEntry?palettId=' + '0') assert diagrams_response.status_code == 200 ############# Select Map layout matrix # Get field status diagrams_response = session.get( '/rest/dependency-map/1.0/field/status') assert diagrams_response.status_code == 200 field2 = diagrams_response.json()["id"] ############# Select filter # Get filter - diagrams_response = session.get( '/rest/dependency-map/1.0/filter?searchTerm=&page=0&resultsPerPage=25' ) assert diagrams_response.status_code == 200 ############## Select columns field # Get filter - diagrams_response = session.get( '/rest/dependency-map/1.0/filter?searchTerm=&page=0&resultsPerPage=25' ) assert diagrams_response.status_code == 200 ################ Create diagram ##################### #Get filterKey randomly among the project in the project file filterKey = getRandomFilter(session) # Get user diagrams_response = session.get('/rest/dependency-map/1.0/user') assert diagrams_response.status_code == 200 userKey = diagrams_response.json()["key"] # Create diagram payload = { 'name': "F100", 'author': userKey, 'lastEditedBy': userKey, 'layoutId': 2, 'filterKey': filterKey, 'boxColorFieldKey': field, 'groupedLayoutFieldKey': field2, 'matrixLayoutHorizontalFieldKey': field2, 'matrixLayoutVerticalFieldKey': field3 } diagrams_response = session.post('/rest/dependency-map/1.0/diagram', json=payload) assert diagrams_response.status_code == 200 diagramId = diagrams_response.json()['id'] guid = diagrams_response.json()['guid'] diagramKey = str(diagramId) saveRemoveDiagramCmd(diagramId) #get diagram diagrams_response = session.get('/rest/dependency-map/1.0/diagram/' + diagramKey) ###### update issue colors # Get user diagrams_response = session.get('/rest/dependency-map/1.0/user') assert diagrams_response.status_code == 200 userKey = diagrams_response.json()["key"] #Update diagram payload = { 'name': "F200", 'id': diagramId, 'author': userKey, 'lastEditedBy': userKey, 'layoutId': 2, 'filterKey': filterKey, 'boxColorFieldKey': field, 'groupedLayoutFieldKey': field2, 'matrixLayoutHorizontalFieldKey': field2, 'matrixLayoutVerticalFieldKey': field3, 'guid': guid } diagrams_response = session.put('/rest/dependency-map/1.0/diagram', json=payload) print(diagrams_response.json()) assert diagrams_response.status_code == 200 #create box colore resource entries. payload = { "diagramId": diagramId, "fieldId": "priority", "fieldOptionId": 1, "colorPaletteEntryId": 5 } diagrams_response = session.post('/rest/dependency-map/1.0/boxColor', json=payload) assert diagrams_response.status_code == 200 payload = { "diagramId": diagramId, "fieldId": "priority", "fieldOptionId": 2, "colorPaletteEntryId": 6 } diagrams_response = session.post('/rest/dependency-map/1.0/boxColor', json=payload) assert diagrams_response.status_code == 200 payload = { "diagramId": diagramId, "fieldId": "priority", "fieldOptionId": 3, "colorPaletteEntryId": 7 } diagrams_response = session.post('/rest/dependency-map/1.0/boxColor', json=payload) assert diagrams_response.status_code == 200 payload = { "diagramId": diagramId, "fieldId": "priority", "fieldOptionId": 4, "colorPaletteEntryId": 8 } diagrams_response = session.post('/rest/dependency-map/1.0/boxColor', json=payload) assert diagrams_response.status_code == 200 ###############Create link config entries # Get user diagrams_response = session.get('/rest/dependency-map/1.0/user') assert diagrams_response.status_code == 200 userKey = diagrams_response.json()["key"] #Update diagram payload = { 'name': "F100", 'id': diagramId, 'author': userKey, 'lastEditedBy': userKey, 'layoutId': 2, 'filterKey': filterKey, 'boxColorFieldKey': field, 'groupedLayoutFieldKey': field2, 'matrixLayoutHorizontalFieldKey': field2, 'matrixLayoutVerticalFieldKey': field3, 'guid': guid } diagrams_response = session.put('/rest/dependency-map/1.0/diagram', json=payload) assert diagrams_response.status_code == 200 #Get color palet entrie diagrams_response = session.get( '/rest/dependency-map/1.0/colorPaletteEntry?paletteId=' + '1') assert diagrams_response.status_code == 200 print(diagrams_response.json()) colorPaletteEntryId = diagrams_response.json()[14]["id"] colorPaletteEntryId2 = diagrams_response.json()[10]["id"] colorPaletteEntryId3 = diagrams_response.json()[12]["id"] #Create linkConfig diagrams_response = session.get('/rest/api/2/issueLinkType') print(diagrams_response.json()) issueLinkTypeIdStr = diagrams_response.json( )['issueLinkTypes'][0]['id'] issueLinkTypeId = int(issueLinkTypeIdStr) issueLinkTypeId2Str = diagrams_response.json( )['issueLinkTypes'][1]['id'] issueLinkTypeId2 = int(issueLinkTypeId2Str) issueLinkTypeId3Str = diagrams_response.json( )['issueLinkTypes'][2]['id'] issueLinkTypeId3 = int(issueLinkTypeId3Str) payload = { 'diagramId': diagramId, 'linkKey': issueLinkTypeId, 'visible': True, 'dashType': 0, 'width': 0, 'colorPaletteEntryId': colorPaletteEntryId } diagrams_response = session.post( '/rest/dependency-map/1.0/linkConfig?diagramId=' + diagramKey, json=payload) assert (diagrams_response.status_code == 200) payload = { 'diagramId': diagramId, 'linkKey': issueLinkTypeId2, 'visible': True, 'dashType': 0, 'width': 0, 'colorPaletteEntryId': colorPaletteEntryId2 } diagrams_response = session.post( '/rest/dependency-map/1.0/linkConfig?diagramId=' + diagramKey, json=payload) assert (diagrams_response.status_code == 200) payload = { 'diagramId': diagramId, 'linkKey': issueLinkTypeId3, 'visible': True, 'dashType': 0, 'width': 0, 'colorPaletteEntryId': colorPaletteEntryId3 } diagrams_response = session.post( '/rest/dependency-map/1.0/linkConfig?diagramId=' + diagramKey, json=payload) assert (diagrams_response.status_code == 200) print("inside11")
def test_change_diagram_config(self, base_url, session): HOSTNAME = os.environ.get('application_hostname') # Get user diagrams_response = session.get('/rest/dependency-map/1.0/user') assert diagrams_response.status_code == 200 userKey = diagrams_response.json()["key"] print_in_shell("User key: " + userKey) # Create diagram payload = { 'name': "D100", 'author': userKey, 'lastEditedBy': userKey, 'layoutId': 0, 'filterKey': 10000, 'boxColorFieldKey': "priority", 'groupedLayoutFieldKey': "priority", 'matrixLayoutHorizontalFieldKey': 'fixVersions', 'matrixLayoutVerticalFieldKey': 'fixVersions' } diagrams_response = session.post('/rest/dependency-map/1.0/diagram', json=payload) assert diagrams_response.status_code == 200 newDiagram = diagrams_response.json() diagramId = str(newDiagram["id"]) print_in_shell('diagramid=' + diagramId) saveRemoveDiagramCmd(diagramId) # Get all priorities diagrams_response = session.get( '/rest/dependency-map/1.0/fieldOption/priority') assert diagrams_response.status_code == 200 priorityItem = diagrams_response.json()[4] priorityItemId = str(priorityItem['id']) print_in_shell('priorityItemId=' + priorityItemId) #Get colore palete entry for diagram for field=priority option=5 diagrams_response = session.get( '/rest/dependency-map/1.0/boxColor?diagramId=' + diagramId + '&fieldId=priority&fieldOptionId=' + priorityItemId) assert diagrams_response.status_code == 200 value = diagrams_response.text if not value: print_in_shell("No response value") else: print_in_shell(diagrams_response.json()) #create box coloure resource entry payload = { "diagramId": diagramId, "fieldId": "priority", "fieldOptionId": priorityItemId, "colorPaletteEntryId": 4 } diagrams_response = session.post('/rest/dependency-map/1.0/boxColor', json=payload) assert diagrams_response.status_code == 200 print_in_shell(diagrams_response.json()) boxColorResource = diagrams_response.json()['id'] #update box coloure resource entry, created if not exists. payload = { "id": boxColorResource, "diagramId": diagramId, "fieldId": "priority", "fieldOptionId": priorityItemId, "colorPaletteEntryId": 5 } diagrams_response = session.put('/rest/dependency-map/1.0/boxColor', json=payload) assert diagrams_response.status_code == 200 print_in_shell(diagrams_response.json())