This repository has been archived by the owner on Jul 8, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Splitted Input Tests in Several Unit Tests
- Loading branch information
Reinhard Grandl
committed
Jun 24, 2015
1 parent
05f997c
commit f4eb276
Showing
6 changed files
with
210 additions
and
60 deletions.
There are no files selected for viewing
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 file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
require 'test/unit' | ||
require 'bitcodin' | ||
require 'json' | ||
require 'coveralls' | ||
Coveralls.wear! | ||
|
||
|
||
module Bitcodin | ||
|
||
class ResponseCodes | ||
|
||
GET = 200 | ||
POST = 201 | ||
DELETE = 204 | ||
PATCH = 200 | ||
|
||
end | ||
|
||
class BitcodinApiCreateTest < Test::Unit::TestCase | ||
|
||
def setup | ||
# read access information (e.g. api key, etc.) from file | ||
file = File.read('test/resources/settings.json') | ||
data = JSON.parse(file) | ||
@apiKey = data['apikey'] | ||
|
||
end | ||
|
||
def test_createInput | ||
# create new bitcodinAPI instance | ||
bitcodinAPI = BitcodinAPI.new(@apiKey) | ||
|
||
# create http config | ||
httpConfig = HTTPInputConfig.new('http://ftp.nluug.nl/pub/graphics/blender/demo/movies/Sintel.2010.720p.mkv') | ||
|
||
# parse response to get input ID | ||
response = bitcodinAPI.createInput(httpConfig) | ||
responseData = JSON.parse(response) | ||
@inputId = responseData['inputId'] | ||
|
||
# check response code | ||
assert_equal(response.code, ResponseCodes::POST) | ||
end | ||
|
||
def teardown | ||
# create new bitcodinAPI instance | ||
bitcodinAPI = BitcodinAPI.new(@apiKey) | ||
|
||
# delete created Input | ||
bitcodinAPI.deleteInput(@inputId) | ||
|
||
end | ||
|
||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
require 'test/unit' | ||
require 'bitcodin' | ||
require 'json' | ||
require 'coveralls' | ||
Coveralls.wear! | ||
|
||
|
||
module Bitcodin | ||
|
||
class ResponseCodes | ||
|
||
GET = 200 | ||
POST = 201 | ||
DELETE = 204 | ||
PATCH = 200 | ||
|
||
end | ||
|
||
class BitcodinApiDeleteTest < Test::Unit::TestCase | ||
|
||
def setup | ||
# read access information (e.g. api key, etc.) from file | ||
file = File.read('test/resources/settings.json') | ||
data = JSON.parse(file) | ||
@apiKey = data['apikey'] | ||
|
||
# create new bitcodinAPI instance | ||
bitcodinAPI = BitcodinAPI.new(@apiKey) | ||
|
||
# create http config | ||
httpConfig = HTTPInputConfig.new('http://ftp.nluug.nl/pub/graphics/blender/demo/movies/Sintel.2010.720p.mkv') | ||
|
||
# create input | ||
response = bitcodinAPI.createInput(httpConfig) | ||
|
||
# parse response to get input ID | ||
responseData = JSON.parse(response) | ||
@inputId = responseData['inputId'] | ||
|
||
end | ||
|
||
def test_deleteInput | ||
# create new bitcodinAPI instance | ||
bitcodinAPI = BitcodinAPI.new(@apiKey) | ||
|
||
# delete created Input | ||
response = bitcodinAPI.deleteInput(@inputId) | ||
|
||
# check response code | ||
assert_equal(response.code, ResponseCodes::DELETE) | ||
end | ||
|
||
def teardown | ||
|
||
end | ||
|
||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
require 'test/unit' | ||
require 'bitcodin' | ||
require 'json' | ||
require 'coveralls' | ||
Coveralls.wear! | ||
|
||
|
||
module Bitcodin | ||
|
||
class ResponseCodes | ||
|
||
GET = 200 | ||
POST = 201 | ||
DELETE = 204 | ||
PATCH = 200 | ||
|
||
end | ||
|
||
class BitcodinApiDetailsTest < Test::Unit::TestCase | ||
|
||
def setup | ||
# read access information (e.g. api key, etc.) from file | ||
file = File.read('test/resources/settings.json') | ||
data = JSON.parse(file) | ||
@apiKey = data['apikey'] | ||
|
||
# create new bitcodinAPI instance | ||
bitcodinAPI = BitcodinAPI.new(@apiKey) | ||
|
||
# create http config | ||
httpConfig = HTTPInputConfig.new('http://ftp.nluug.nl/pub/graphics/blender/demo/movies/Sintel.2010.720p.mkv') | ||
|
||
# parse response to get input ID | ||
response = bitcodinAPI.createInput(httpConfig) | ||
responseData = JSON.parse(response) | ||
@inputId = responseData['inputId'] | ||
end | ||
|
||
def test_getInputDetails | ||
bitcodinAPI = BitcodinAPI.new(@apiKey) | ||
response = bitcodinAPI.getInputDetails(@inputId) | ||
assert_equal(response.code, ResponseCodes::GET) | ||
end | ||
|
||
def teardown | ||
# create new bitcodinAPI instance | ||
bitcodinAPI = BitcodinAPI.new(@apiKey) | ||
|
||
# delete created Input | ||
bitcodinAPI.deleteInput(@inputId) | ||
|
||
end | ||
|
||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
require 'test/unit' | ||
require 'bitcodin' | ||
require 'json' | ||
require 'coveralls' | ||
Coveralls.wear! | ||
|
||
|
||
module Bitcodin | ||
|
||
class ResponseCodes | ||
|
||
GET = 200 | ||
POST = 201 | ||
DELETE = 204 | ||
PATCH = 200 | ||
|
||
end | ||
|
||
class BitcodinApiListTest < Test::Unit::TestCase | ||
|
||
def setup | ||
# read access information (e.g. api key, etc.) from file | ||
file = File.read('test/resources/settings.json') | ||
data = JSON.parse(file) | ||
apiKey = data['apikey'] | ||
|
||
# create new bitcodinAPI instance | ||
@bitcodinAPI = BitcodinAPI.new(apiKey) | ||
end | ||
|
||
def test_listInput | ||
response = @bitcodinAPI.listInput | ||
assert_equal(response.code, ResponseCodes::GET) | ||
end | ||
|
||
def teardown | ||
## Nothing up to now | ||
end | ||
|
||
end | ||
end |