This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This was inspired by: https://gist.github.com/johnbintz/36bd6d6bcd9e6cfcb8f4 | |
# the idea is that capistrano is an overkill for this docker deploy, so it's much easier to add rake tasks with sshkit. | |
# sshkit (which is used by capistrano) is much lighter than capistrano | |
require 'sshkit' | |
require 'sshkit/dsl' | |
include SSHKit::DSL | |
name = "my-cool-application" | |
app_name = "my-cool-application/app" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def compute_status | |
statuses = all_statuses.uniq - ['N/A'] #take all statuses, make them unique, remove 'N/A' | |
if statuses.include?("FAILED") #if you have FAILED, everything is FAILED | |
"FAILED" | |
elsif statuses.include?("BLOCKED") # otherwise, if you have BLOCKED, everything is set to BLOCKED | |
"BLOCKED" | |
elsif (statuses == ["NO RUN"]) || statuses.empty? # IF YOU HAVE "NO RUN", or don't have steps at all -> It should be no run | |
"NO RUN" | |
elsif statuses == ["PASSED"] #if you're left with only one status -> PASSED, it means that all steps are passed (we already did unique, remember?) | |
"PASSED" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$api_token = ""; // here goes your api_token | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, "https://api.practitest.com/api/v1/automated_tests/upload_test_result.json"); | |
curl_setopt($ch, CURLOPT_POST, 1); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, "{}"); // here goes the JSON you're uploading | |
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Authorization: custom api_token=" . $api_token)); | |
# on some older linux distros, our CA is not recognized, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import requests | |
URL = "https://api.practitest.com/api/v1/sets/1/instances.json" | |
headers = { | |
'Authorization': 'custom api_token=your_token', | |
'Content-Type': 'application/json', | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
require 'net/https' | |
require 'uri' | |
require 'json' | |
URL = "https://api.practitest.com/api/v1" | |
API_TOKEN = "your_api_token" | |
json_results = { | |
project_id: 1890, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
require 'net/https' | |
require 'digest/md5' | |
require 'uri' | |
URL = "https://prod.practitest.com/api/v1" | |
API_TOKEN = "your_new_api_token" | |
def authorization | |
{"Authorization" => "custom api_token=#{API_TOKEN}"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
headers = { | |
'Authorization': 'custom api_token=your_token', | |
'Content-Type': 'application/json', | |
} | |
data = '{ "project_id": 2, "instance_display_id": "2:1", "exit_code": 0 }' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
require 'net/https' | |
require 'uri' | |
require 'json' | |
URL = "https://api.practitest.com/api/v1" | |
API_TOKEN = "your_api_token" | |
def authorization |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
require 'net/https' | |
require 'uri' | |
URL = "https://api.practitest.com/api/v1" | |
API_TOKEN = "your_api_token" | |
def get_request(path, extra_params = {}) | |
uri = URI.parse("#{URL}/#{path}") | |
uri.query = URI.encode_www_form(extra_params) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Calling PractiTest's API -- this script is irrelevant. | |
// Use now API_TOKEN only in the header, and json only | |
using System; | |
using System.IO; | |
using System.Net; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Xml; | |
using System.Security.Cryptography; |
NewerOlder