Class: TestCyP450

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
test/test_model/cyp450.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) setup



19
20
21
# File 'test/test_model/cyp450.rb', line 19

def setup
  @cyp450 = ODDB::CyP450.new("foo")
end

- (Object) test_create_cyp450inducer



22
23
24
25
# File 'test/test_model/cyp450.rb', line 22

def test_create_cyp450inducer
  @cyp450.create_cyp450inducer('connection')
  assert_equal(1, @cyp450.inducers.size)
end

- (Object) test_create_cyp450inhibitor



26
27
28
29
# File 'test/test_model/cyp450.rb', line 26

def test_create_cyp450inhibitor
  @cyp450.create_cyp450inhibitor('connection')
  assert_equal(1, @cyp450.inhibitors.size)
end

- (Object) test_cyp450inducer



30
31
32
33
34
35
36
37
38
# File 'test/test_model/cyp450.rb', line 30

def test_cyp450inducer
  @cyp450.inducers = {
    'inducer_id_1' =>  'inducer_1',
    'inducer_id_2' =>  'inducer_2',
    'inducer_id_3' =>  'inducer_3',
  }
  result = @cyp450.cyp450inducer('inducer_id_2')
  assert_equal('inducer_2', result)
end

- (Object) test_cyp450inhibitor



39
40
41
42
43
44
45
46
47
# File 'test/test_model/cyp450.rb', line 39

def test_cyp450inhibitor
  @cyp450.inhibitors = {
    'inhibitor_id_1' =>  'inhibitor_1',
    'inhibitor_id_2' =>  'inhibitor_2',
    'inhibitor_id_3' =>  'inhibitor_3',
  }
  result = @cyp450.cyp450inhibitor('inhibitor_id_2')
  assert_equal('inhibitor_2', result)
end

- (Object) test_delete_cyp450inducer



48
49
50
51
52
53
54
# File 'test/test_model/cyp450.rb', line 48

def test_delete_cyp450inducer
  @cyp450.inducers = {
    'inducer_id' =>  'inducer_1',
  }
  @cyp450.delete_cyp450inducer('inducer_id')
  assert_equal({}, @cyp450.inducers)
end

- (Object) test_delete_cyp450inhibitor



55
56
57
58
59
60
61
# File 'test/test_model/cyp450.rb', line 55

def test_delete_cyp450inhibitor
  @cyp450.inhibitors = {
    'inhibitor_id' =>  'inhibitor_1',
  }
  @cyp450.delete_cyp450inhibitor('inhibitor_id')
  assert_equal({}, @cyp450.inhibitors)
end

- (Object) test_interactions_with



62
63
64
65
# File 'test/test_model/cyp450.rb', line 62

def test_interactions_with
  result = @cyp450.interactions_with(nil)
  assert_equal([], result)
end

- (Object) test_interactions_with2



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'test/test_model/cyp450.rb', line 66

def test_interactions_with2
  substance = FlexMock.new('substance')
  inh_connection1 = FlexMock.new('inh_connection1')
  inh_connection2 = FlexMock.new('inh_connection2')
  ind_connection1 = FlexMock.new('ind_connection1')
  ind_connection2 = FlexMock.new('ind_connection2')
  @cyp450.inhibitors = {
    'inh_conn1'  => inh_connection1,  
    'inh_conn2'  => inh_connection2,  
  }
  @cyp450.inducers = {
    'ind_conn1'  => ind_connection1,  
    'ind_conn2'  => inh_connection2,  
  }
  substance.should_receive(:connection_keys).and_return { [ 'connection_key' ] }
  substance.should_receive(:_search_keys).and_return { [ 'substance' ] }
  result = @cyp450.interactions_with(substance)
  assert_equal([], result)
end

- (Object) test_interactions_with3



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'test/test_model/cyp450.rb', line 85

def test_interactions_with3
  substance = FlexMock.new('substance')
  inh_connection1 = FlexMock.new('inh_connection1')
  inh_connection2 = FlexMock.new('inh_connection2')
  ind_connection1 = FlexMock.new('ind_connection1')
  ind_connection2 = FlexMock.new('ind_connection2')
  @cyp450.inhibitors = {
    'inh_conn1'  => inh_connection1,  
    'inh_conn2'  => inh_connection2,  
  }
  @cyp450.inducers = {
    'ind_conn1'  => ind_connection1,  
    'ind_conn2'  => ind_connection2,  
  }
  substance.should_receive(:connection_keys).and_return {
    [ 'inh_conn2', 'ind_conn1', 'ind_conn2' ]
  }
  substance.should_receive(:_search_keys).and_return { [ 'substance' ] }
  result = @cyp450.interactions_with(substance)
  expected = [ inh_connection2, ind_connection1, ind_connection2 ]
  assert_equal(expected, result)
end