Skip to content

Commit a11da5c

Browse files
authored
Merge pull request #24 from watson-developer-cloud/fix-integration-tests-optional-credentials
Fix issue when integration credentials are not provided
2 parents c26550e + 84ac100 commit a11da5c

12 files changed

+80
-11
lines changed

.rubocop.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1584,6 +1584,9 @@ Lint/UnusedMethodArgument:
15841584
Lint/Void:
15851585
CheckForMethodsWithNoSideEffects: false
15861586

1587+
Rails:
1588+
Enabled: false
1589+
15871590
#################### Performance ###########################
15881591

15891592
Performance/DoubleStartEndWith:

test/integration/test_assistant_v1.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
require_relative("./../test_helper.rb")
44
SimpleCov.command_name "test:integration"
55

6-
unless ENV["ASSISTANT_USERNAME"].nil? || ENV["ASSISTANT_PASSWORD"].nil?
6+
if !ENV["ASSISTANT_USERNAME"].nil? && !ENV["ASSISTANT_PASSWORD"].nil?
77
# Integration tests for the Watson Assistant V1 Service
88
class AssistantV1Test < Minitest::Test
99
def test_create_update_delete_workspace
@@ -652,4 +652,10 @@ def test_delete_user_data
652652
assert(service_response.nil?)
653653
end
654654
end
655+
else
656+
class AssistantV1Test < Minitest::Test
657+
def test_missing_credentials_skip_integration
658+
skip "Skip assistant integration tests because credentials have not been provided"
659+
end
660+
end
655661
end

test/integration/test_discovery_v1.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
require_relative("./../test_helper.rb")
44
require("minitest/hooks/test")
55

6-
unless ENV["DISCOVERY_USERNAME"].nil? || ENV["DISCOVERY_PASSWORD"].nil?
6+
if !ENV["DISCOVERY_USERNAME"].nil? && !ENV["DISCOVERY_PASSWORD"].nil?
77
# Integration tests for the Discovery V1 Service
88
class DiscoveryV1Test < Minitest::Test
99
include Minitest::Hooks
@@ -208,4 +208,10 @@ def test_list_credentials
208208
refute(credentials.nil?)
209209
end
210210
end
211+
else
212+
class DiscoveryV1Test < Minitest::Test
213+
def test_missing_credentials_skip_integration
214+
skip "Skip discovery integration tests because credentials have not been provided"
215+
end
216+
end
211217
end

test/integration/test_iam_assistant_v1.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
require_relative("./../test_helper.rb")
44

5-
unless ENV["ASSISTANT_IAM_URL"].nil? || ENV["ASSISTANT_IAM_APIKEY"].nil?
5+
if !ENV["ASSISTANT_IAM_URL"].nil? && !ENV["ASSISTANT_IAM_APIKEY"].nil?
66
# Integration tests for the Watson Assistant V1 Service
77
class IAMAssistantV1Test < Minitest::Test
88
def test_create_update_delete_workspace
@@ -715,4 +715,10 @@ def test_receive_error
715715
assert(error_received)
716716
end
717717
end
718+
else
719+
class IAMAssistantV1Test < Minitest::Test
720+
def test_missing_credentials_skip_integration
721+
skip "Skip iam assistant integration tests because credentials have not been provided"
722+
end
723+
end
718724
end

test/integration/test_language_translator_v3.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
require_relative("./../test_helper.rb")
55
require("minitest/hooks/test")
66

7-
unless ENV["LANGUAGE_TRANSLATOR_V3_USERNAME"].nil? || ENV["LANGUAGE_TRANSLATOR_V3_PASSWORD"].nil?
7+
if !ENV["LANGUAGE_TRANSLATOR_V3_USERNAME"].nil? && !ENV["LANGUAGE_TRANSLATOR_V3_PASSWORD"].nil?
88
# Integration tests for the Language Translator V3 Service
99
class LanguageTranslatorV3Test < Minitest::Test
1010
include Minitest::Hooks
@@ -80,4 +80,10 @@ def test_create_delete_model
8080
assert_equal("OK", service_response["status"])
8181
end
8282
end
83+
else
84+
class LanguageTranslatorV3Test < Minitest::Test
85+
def test_missing_credentials_skip_integration
86+
skip "Skip language translator integration tests because credentials have not been provided"
87+
end
88+
end
8389
end

test/integration/test_natural_language_classifier_v1.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
require_relative("./../test_helper.rb")
55
require("minitest/hooks/test")
66

7-
unless ENV["NATURAL_LANGUAGE_CLASSIFIER_USERNAME"].nil? || ENV["NATURAL_LANGUAGE_CLASSIFIER_PASSWORD"].nil?
7+
if !ENV["NATURAL_LANGUAGE_CLASSIFIER_USERNAME"].nil? && !ENV["NATURAL_LANGUAGE_CLASSIFIER_PASSWORD"].nil?
88
# Integration tests for the Natural Language Classifier V1 Service
99
class NaturalLanguageClassifierV1Test < Minitest::Test
1010
include Minitest::Hooks
@@ -68,4 +68,10 @@ def test_classify_text
6868
)
6969
end
7070
end
71+
else
72+
class NaturalLanguageClassifierV1Test < Minitest::Test
73+
def test_missing_credentials_skip_integration
74+
skip "Skip natural language classifier integration tests because credentials have not been provided"
75+
end
76+
end
7177
end

test/integration/test_natural_language_understanding_v1.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
require("json")
44
require_relative("./../test_helper.rb")
55

6-
unless ENV["NATURAL_LANGUAGE_UNDERSTANDING_USERNAME"].nil? || ENV["NATURAL_LANGUAGE_UNDERSTANDING_PASSWORD"].nil?
6+
if !ENV["NATURAL_LANGUAGE_UNDERSTANDING_USERNAME"].nil? && !ENV["NATURAL_LANGUAGE_UNDERSTANDING_PASSWORD"].nil?
77
# Integration tests for the Natural Language Understanding V1 Service
88
class NaturalLanguageUnderstandingV1Test < Minitest::Test
99
def test_text_analyze
@@ -98,4 +98,10 @@ def test_list_models
9898
assert((200..299).cover?(service_response.status))
9999
end
100100
end
101+
else
102+
class NaturalLanguageUnderstandingV1Test < Minitest::Test
103+
def test_missing_credentials_skip_integration
104+
skip "Skip natural language understanding integration tests because credentials have not been provided"
105+
end
106+
end
101107
end

test/integration/test_personality_insights_v3.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
require("json")
44
require_relative("./../test_helper.rb")
55

6-
unless ENV["PERSONALITY_INSIGHTS_USERNAME"].nil? || ENV["PERSONALITY_INSIGHTS_PASSWORD"].nil?
6+
if !ENV["PERSONALITY_INSIGHTS_USERNAME"].nil? && !ENV["PERSONALITY_INSIGHTS_PASSWORD"].nil?
77
# Integration tests for the Personality Insights V3 Service
88
class PersonalityInsightsV3Test < Minitest::Test
99
def test_plain_to_json
@@ -94,4 +94,10 @@ def test_plain_to_json_es
9494
assert((200..299).cover?(service_response.status))
9595
end
9696
end
97+
else
98+
class PersonalityInsightsV3Test < Minitest::Test
99+
def test_missing_credentials_skip_integration
100+
skip "Skip personality insights integration tests because credentials have not been provided"
101+
end
102+
end
97103
end

test/integration/test_speech_to_text_v1.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def on_inactivity_timeout(*)
2222
end
2323
end
2424

25-
unless ENV["SPEECH_TO_TEXT_USERNAME"].nil? || ENV["SPEECH_TO_TEXT_PASSWORD"].nil?
25+
if !ENV["SPEECH_TO_TEXT_USERNAME"].nil? && !ENV["SPEECH_TO_TEXT_PASSWORD"].nil?
2626
# Integration tests for the Speech to Text V1 Service
2727
class SpeechToTextV1Test < Minitest::Test
2828
include Minitest::Hooks
@@ -250,4 +250,10 @@ def test_add_word
250250
)
251251
end
252252
end
253+
else
254+
class SpeechToTextV1Test < Minitest::Test
255+
def test_missing_credentials_skip_integration
256+
skip "Skip speech to text integration tests because credentials have not been provided"
257+
end
258+
end
253259
end

test/integration/test_text_to_speech_v1.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
require_relative("./../test_helper.rb")
44
require("minitest/hooks/test")
55

6-
unless ENV["TEXT_TO_SPEECH_USERNAME"].nil? || ENV["TEXT_TO_SPEECH_PASSWORD"].nil?
6+
if !ENV["TEXT_TO_SPEECH_USERNAME"].nil? && !ENV["TEXT_TO_SPEECH_PASSWORD"].nil?
77
# Integration tests for the Text to Speech V1 Service
88
class TextToSpeechV1Test < Minitest::Test
99
include Minitest::Hooks
@@ -81,4 +81,10 @@ def test_custom_words
8181
)
8282
end
8383
end
84+
else
85+
class TextToSpeechV1Test < Minitest::Test
86+
def test_missing_credentials_skip_integration
87+
skip "Skip text to speech integration tests because credentials have not been provided"
88+
end
89+
end
8490
end

0 commit comments

Comments
 (0)