-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
141 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
require 'test_helper' | ||
|
||
class ClientTests < MiniTest::Unit::TestCase | ||
|
||
def test_client | ||
assert_equal true, @client.api_token? | ||
assert_equal "https://www.camdram.net", @client.base_url | ||
assert_equal "Camdram Ruby v#{@client.version}", @client.user_agent | ||
end | ||
|
||
def test_client_show_byid | ||
show = @client.get_show(6514) | ||
assert_equal "This show is a dummy used by Camdram for testing purposes only.", show.description | ||
assert_equal "5b58b83bd534a.jpg", show.image.filename | ||
assert_equal 1024, show.image.width | ||
assert_equal "API Test 1", show.name | ||
assert_equal "Camdram", show.other_society | ||
assert_equal "ADC Theatre", show.other_venue | ||
assert_equal 29, show.performances.first.venue.id | ||
assert_equal "1997-api-test-1", show.slug | ||
assert_equal 38, show.society.id | ||
assert_equal "Camdram", show.society.name | ||
assert_equal 29, show.venue.id | ||
assert_equal "ADC Theatre", show.venue.name | ||
end | ||
|
||
def test_client_show_byslug | ||
show = @client.get_show("1997-api-test-1") | ||
assert_equal 6514, show.id | ||
assert_equal "This show is a dummy used by Camdram for testing purposes only.", show.description | ||
assert_equal "5b58b83bd534a.jpg", show.image.filename | ||
assert_equal 1024, show.image.width | ||
assert_equal "API Test 1", show.name | ||
assert_equal "Camdram", show.other_society | ||
assert_equal "ADC Theatre", show.other_venue | ||
assert_equal 29, show.performances.first.venue.id | ||
assert_equal 38, show.society.id | ||
assert_equal "Camdram", show.society.name | ||
assert_equal 29, show.venue.id | ||
assert_equal "ADC Theatre", show.venue.name | ||
end | ||
|
||
def test_client_organisation_byid | ||
org = @client.get_org(38) | ||
assert_equal "Camdram", org.name | ||
assert_equal "Camdram", org.short_name | ||
assert_equal "camdram", org.slug | ||
assert_equal "1002481303", org.twitter_id | ||
end | ||
|
||
def test_client_organisation_byslug | ||
org = @client.get_org("camdram") | ||
assert_equal 38, org.id | ||
assert_equal "Camdram", org.name | ||
assert_equal "Camdram", org.short_name | ||
assert_equal "1002481303", org.twitter_id | ||
end | ||
|
||
def test_client_venue_byid | ||
venue = @client.get_venue(29) | ||
assert_equal "ADC Theatre", venue.name | ||
assert_equal "ADC Theatre", venue.short_name | ||
assert_equal "adc-theatre", venue.slug | ||
assert_equal "33348320992", venue.facebook_id | ||
assert_equal "36725639", venue.twitter_id | ||
end | ||
|
||
def test_client_venue_byslug | ||
venue = @client.get_venue("adc-theatre") | ||
assert_equal 29, venue.id | ||
assert_equal "ADC Theatre", venue.name | ||
assert_equal "ADC Theatre", venue.short_name | ||
assert_equal "33348320992", venue.facebook_id | ||
assert_equal "36725639", venue.twitter_id | ||
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,49 @@ | ||
require 'test_helper' | ||
|
||
class SearchTests < MiniTest::Unit::TestCase | ||
|
||
def test_search_show | ||
entity = @client.search("API Test")[0].entity | ||
assert_equal 6514, entity.id | ||
assert_equal "This show is a dummy used by Camdram for testing purposes only.", entity.description | ||
assert_equal "5b58b83bd534a.jpg", entity.image.filename | ||
assert_equal 1024, entity.image.width | ||
assert_equal "API Test 1", entity.name | ||
assert_equal "Camdram", entity.other_society | ||
assert_equal "ADC Theatre", entity.other_venue | ||
assert_equal 29, entity.performances.first.venue.id | ||
assert_equal "1997-api-test-1", entity.slug | ||
assert_equal 38, entity.society.id | ||
assert_equal "Camdram", entity.society.name | ||
assert_equal 29, entity.venue.id | ||
assert_equal "ADC Theatre", entity.venue.name | ||
end | ||
|
||
def test_search_organisation | ||
entity = @client.search("CUADC")[0].entity | ||
assert_equal 1, entity.id | ||
assert_equal "Cambridge University Amateur Dramatic Club", entity.name | ||
assert_equal "CUADC", entity.short_name | ||
assert_equal "cambridge-university-amateur-dramatic-club", entity.slug | ||
assert_equal "189141344500085", entity.facebook_id | ||
assert_equal "472457773", entity.twitter_id | ||
end | ||
|
||
def test_search_venue | ||
entity = @client.search("ADC Theatre")[0].entity | ||
assert_equal 29, entity.id | ||
assert_equal "ADC Theatre", entity.name | ||
assert_equal "ADC Theatre", entity.short_name | ||
assert_equal "adc-theatre", entity.slug | ||
assert_equal "33348320992", entity.facebook_id | ||
assert_equal "36725639", entity.twitter_id | ||
end | ||
|
||
def test_search_person | ||
entity = @client.search("Charlie Jonas")[0].entity | ||
assert_equal 13865, entity.id | ||
assert_equal "Charlie Jonas", entity.name | ||
assert_equal "charlie-jonas", entity.slug | ||
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 |
---|---|---|
@@ -1,16 +1,16 @@ | ||
require 'test_helper' | ||
|
||
class UserTests < MiniTest::Unit::TestCase | ||
class ClientTests < MiniTest::Unit::TestCase | ||
|
||
def test_user | ||
user = @client.user | ||
assert_equal 3807, user.id | ||
assert_equal "Charlie Jonas", user.name | ||
assert_equal "[email protected]", user.email | ||
end | ||
|
||
def test_get_shows | ||
user = @client.user | ||
show = user.get_shows.first | ||
def test_user_shows | ||
show = @client.user.get_shows.first | ||
assert_equal 6514, show.id | ||
assert_equal "This show is a dummy used by Camdram for testing purposes only.", show.description | ||
assert_equal "5b58b83bd534a.jpg", show.image.filename | ||
|
@@ -26,13 +26,22 @@ def test_get_shows | |
assert_equal "ADC Theatre", show.venue.name | ||
end | ||
|
||
def test_get_organisations | ||
user = @client.user | ||
org = user.get_orgs.first | ||
def test_user_organisations | ||
org = @client.user.get_orgs.first | ||
assert_equal 38, org.id | ||
assert_equal "Camdram", org.name | ||
assert_equal "Camdram", org.short_name | ||
assert_equal "camdram", org.slug | ||
assert_equal "1002481303", org.twitter_id | ||
end | ||
|
||
def test_user_venues | ||
venue = @client.user.get_venues.first | ||
assert_equal 29, venue.id | ||
assert_equal "ADC Theatre", venue.name | ||
assert_equal "ADC Theatre", venue.short_name | ||
assert_equal "adc-theatre", venue.slug | ||
assert_equal "33348320992", venue.facebook_id | ||
assert_equal "36725639", venue.twitter_id | ||
end | ||
end |