Class: TLSPretense::TestHarness::SSLTestCase

Inherits:
Object
  • Object
show all
Includes:
PacketThief::Logging
Defined in:
lib/tlspretense/test_harness/ssl_test_case.rb

Overview

Represents a single test case.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from PacketThief::Logging

log

Constructor Details

#initialize(appctx, testdesc) ⇒ SSLTestCase

Returns a new instance of SSLTestCase.



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/tlspretense/test_harness/ssl_test_case.rb', line 25

def initialize(appctx, testdesc)
  @appctx = appctx
  @raw = testdesc.dup
  @id = @raw['alias']
  @description = @raw['name']
  @certchainalias = @raw['certchain']
  @expected_result = @raw['expected_result']
  # ensure that the certificate exists
  @certchain ||= @appctx.cert_manager.get_chain(@certchainalias)
  @keychain ||= @appctx.cert_manager.get_keychain(@certchainalias)
  @hosttotest ||= @appctx.config.hosttotest
  nil
end

Instance Attribute Details

#certchainObject (readonly)

Returns the value of attribute certchain.



12
13
14
# File 'lib/tlspretense/test_harness/ssl_test_case.rb', line 12

def certchain
  @certchain
end

#certchainaliasObject (readonly)

Returns the value of attribute certchainalias.



9
10
11
# File 'lib/tlspretense/test_harness/ssl_test_case.rb', line 9

def certchainalias
  @certchainalias
end

#descriptionObject (readonly)

Returns the value of attribute description.



8
9
10
# File 'lib/tlspretense/test_harness/ssl_test_case.rb', line 8

def description
  @description
end

#expected_resultObject (readonly)

Returns the value of attribute expected_result.



10
11
12
# File 'lib/tlspretense/test_harness/ssl_test_case.rb', line 10

def expected_result
  @expected_result
end

#hosttotestObject (readonly)

Returns the value of attribute hosttotest.



14
15
16
# File 'lib/tlspretense/test_harness/ssl_test_case.rb', line 14

def hosttotest
  @hosttotest
end

#idObject (readonly)

Returns the value of attribute id.



7
8
9
# File 'lib/tlspretense/test_harness/ssl_test_case.rb', line 7

def id
  @id
end

#keychainObject (readonly)

Returns the value of attribute keychain.



13
14
15
# File 'lib/tlspretense/test_harness/ssl_test_case.rb', line 13

def keychain
  @keychain
end

Class Method Details

.factory(appctx, test_data, tests_to_create) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/tlspretense/test_harness/ssl_test_case.rb', line 16

def self.factory(appctx, test_data, tests_to_create)
  if tests_to_create == [] or tests_to_create == nil
    final_test_data = test_data
  else
    final_test_data = tests_to_create.map { |name| test_data.select { |test| test['alias'] == name }[0] }
  end
  final_test_data.map { |data| SSLTestCase.new(appctx, data) }
end