MCPcopy
hub / github.com/jtesta/ssh-audit / test_timeframe_object

Method test_timeframe_object

test/test_algorithm.py:129–166  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

127 assert dv in repr(tf1) and dv in repr(tf2) and dv in repr(tf3)
128
129 def test_timeframe_object(self):
130 tf = self._tf(['6.1,6.2C', '6.6', '7.1'])
131 assert 'OpenSSH' in tf
132 assert 'Dropbear SSH' not in tf
133 assert 'libssh' not in tf
134 assert 'unknown' not in tf
135 assert tf['OpenSSH'] == ('6.1', '6.6', '6.2', '7.1')
136 assert tf['Dropbear SSH'] == (None, None, None, None)
137 assert tf['libssh'] == (None, None, None, None)
138 assert tf['unknown'] == (None, None, None, None)
139 assert tf.get_from('OpenSSH', True) == '6.1'
140 assert tf.get_till('OpenSSH', True) == '6.6'
141 assert tf.get_from('OpenSSH', False) == '6.2'
142 assert tf.get_till('OpenSSH', False) == '7.1'
143
144 tf = self._tf(['6.1,d2016.72,6.2C', '6.6,d2016.73', '7.1,d2016.74'])
145 assert 'OpenSSH' in tf
146 assert 'Dropbear SSH' in tf
147 assert 'libssh' not in tf
148 assert 'unknown' not in tf
149 assert tf['OpenSSH'] == ('6.1', '6.6', '6.2', '7.1')
150 assert tf['Dropbear SSH'] == ('2016.72', '2016.73', '2016.72', '2016.74')
151 assert tf['libssh'] == (None, None, None, None)
152 assert tf['unknown'] == (None, None, None, None)
153 assert tf.get_from('OpenSSH', True) == '6.1'
154 assert tf.get_till('OpenSSH', True) == '6.6'
155 assert tf.get_from('OpenSSH', False) == '6.2'
156 assert tf.get_till('OpenSSH', False) == '7.1'
157 assert tf.get_from('Dropbear SSH', True) == '2016.72'
158 assert tf.get_till('Dropbear SSH', True) == '2016.73'
159 assert tf.get_from('Dropbear SSH', False) == '2016.72'
160 assert tf.get_till('Dropbear SSH', False) == '2016.74'
161 ov = "'OpenSSH': ['6.1', '6.6', '6.2', '7.1']"
162 dv = "'Dropbear SSH': ['2016.72', '2016.73', '2016.72', '2016.74']"
163 assert ov in str(tf)
164 assert dv in str(tf)
165 assert ov in repr(tf)
166 assert dv in repr(tf)

Callers

nothing calls this directly

Calls 3

_tfMethod · 0.95
get_fromMethod · 0.80
get_tillMethod · 0.80

Tested by

no test coverage detected