Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
prepare_database(fingerprint_db, """
INSERT INTO fingerprint (fingerprint, length, track_id, submission_count)
VALUES (%(fp)s, %(len)s, 1, 1);
""", dict(fp=TEST_1A_FP_RAW, len=TEST_1A_LENGTH))
submission_id = insert_submission(ingest_db, {
'fingerprint': TEST_2_FP_RAW,
'length': TEST_2_LENGTH,
'source_id': 1,
'mbid': '1f143d2b-db04-47cc-82a0-eee6efaa1142',
'puid': '7c1c6753-c834-44b1-884a-a5166c093139',
})
query = tables.submission.select(tables.submission.c.id == submission_id)
submission = ingest_db.execute(query).fetchone()
assert_false(submission['handled'])
fingerprint = import_submission(ingest_db, app_db, fingerprint_db, ctx.index, submission)
assert fingerprint is not None
assert_equals(2, fingerprint['id'])
assert_equals(5, fingerprint['track_id'])
measure = plugin.running_measure
assert_equal(measure.status, 'RUNNING')
assert_equal(measure.infos, 'The measure is running')
# Check the monitors connections, that it started and received notif.
monitor = measure.monitors.values()[0]
assert_true(engine.has_observer('news', monitor.process_news))
assert_equal(monitor.black_box, ['Started'])
assert_equal(monitor.engine_news, {'root/default_path': 'test'})
# Make the engine send the done event.
engine.complete_measure()
# Check engine state.
assert_false(engine.active)
assert_false(engine.has_observers('news'))
# Check measure state.
assert_equal(measure.status, 'COMPLETED')
assert_equal(measure.infos, 'Measure successfully completed')
# Check plugin state.
assert_false(plugin.flags)
# Closing workspace.
core = self.workbench.get_plugin(u'enaml.workbench.core')
core.invoke_command(u'enaml.workbench.ui.close_workspace', {}, self)
# Check monitors stopped properly.
assert_equal(monitor.black_box, ['Started', 'Stopped'])
def test_21_constructor_bash5(self):
# Tests specific to the v2.0 bas.h5 constructor
reader = pbcore.io.BasH5Reader(self.bash5_filename)
nose.tools.assert_false(reader.hasConsensusBasecalls)
nose.tools.assert_equal(reader.movieName, pbcore.data.MOVIE_NAME_21)
reader.close()
def test_check_multichannel_interface1(self):
# Check the multichannel specific tests, passing.
interface = MultiChannelVoltageSourceInterface(task=self.task)
interface.channel = 1
self.task.interface = interface
self.task.target_value = '1.0'
profile = {'Test1': ({'defined_channels': [[1]]},
{})}
self.root.run_time['profiles'] = profile
test, traceback = self.task.check(test_instr=True)
assert_true(test)
assert_false(traceback)
def test_generate_cloudtrail_invalid_event_pattern(self, mock_logging):
"""CLI - Terraform Generate Cloudtrail Module - Invalid Event Pattern"""
cluster_name = 'advanced'
self.config['clusters']['advanced']['modules']['cloudtrail'] = {
'enable_logging': True,
'enable_kinesis': True,
'existing_trail': False,
'is_global_trail': False,
'event_pattern': {
'invalid': ['aws.ec2']
}
}
result = cloudtrail.generate_cloudtrail(cluster_name, self.cluster_dict, self.config)
assert_false(result)
assert_true(mock_logging.error.called)
def other_still_are_not_mounts(self):
assert_false(self.ismount('/other'))
def containment(options):
"Check whether {cls} contains keys"
mapping = options.constructor(
{'foo': 'bar', frozenset((1, 2, 3)): 'abc', 1: 2}
)
empty = options.constructor()
assert_true('foo' in mapping)
assert_false('foo' in empty)
assert_true(frozenset((1, 2, 3)) in mapping)
assert_false(frozenset((1, 2, 3)) in empty)
assert_true(1 in mapping)
assert_false(1 in empty)
assert_false('banana' in mapping)
assert_false('banana' in empty)
def test_database_modified1(self):
""" Test handling the adding of an entry to the database.
"""
self.monitor.database_modified({'value': ('test/entry_test', 1)})
assert_equal(self.monitor.database_entries, ['test/entry_test'])
assert_equal(len(self.monitor.displayed_entries), 1)
assert_false(self.monitor.undisplayed_entries)
assert_false(self.monitor.hidden_entries)
entry = self.monitor.displayed_entries[0]
assert_equal(entry.path, 'test/entry_test')
assert_equal(entry.name, 'entry_test')
assert_equal(entry.formatting, '{test/entry_test}')
assert_equal(entry.depend_on, ['test/entry_test'])
assert_equal(self.monitor._database_values, {'test/entry_test': 1})
assert_in('test/entry_test', self.monitor.updaters)
def test_check_registation1(self):
""" Test that debuggers are properly found at start-up.
"""
self.workbench.register(DebuggerManifest())
self.workbench.register(DummyDebugger1())
plugin = self.workbench.get_plugin(u'hqc_meas.debug')
assert_in(u'dummy.debugger1', plugin.debuggers)
assert_true(plugin._debugger_extensions)
self.workbench.unregister(u'dummy.debugger1')
assert_not_in(u'dummy.debugger1', plugin.debuggers)
assert_false(plugin._debugger_extensions)
def test_database_modified2(self):
""" Test handling the adding of an entry subject to a reject rule.
"""
self.monitor.rules.append(RejectRule(name='Test', suffixes=['test']))
self.monitor.database_modified({'value': ('root/make_test', 1)})
assert_equal(self.monitor.database_entries, [])
assert_false(self.monitor.displayed_entries)
assert_equal(len(self.monitor.undisplayed_entries), 1)
assert_false(self.monitor.hidden_entries)
assert_equal(self.monitor.undisplayed_entries[0].depend_on,
['root/make_test'])
assert_equal(self.monitor._database_values, {'root/make_test': 1})
assert_false(self.monitor.updaters)