def test_benchmark_start(self, check_output, exists, action_set): exists.return_value = True check_output.return_value = "data" action_set.return_value = True self.assertTrue(Benchmark.start()) COLLECT_PROFILE_DATA = '/usr/local/bin/collect-profile-data' exists.assert_any_call(COLLECT_PROFILE_DATA) check_output.assert_any_call([COLLECT_PROFILE_DATA])
def test_benchmark_start(self, check_output, exists, action_set, relation_ids, relation_set): exists.return_value = True check_output.return_value = "data" action_set.return_value = True relation_ids.return_value = ['benchmark:1'] self.assertTrue(Benchmark.start()) relation_set.assert_called_once_with( relation_id='benchmark:1', relation_settings={'action_id': 'my_action'} ) COLLECT_PROFILE_DATA = '/usr/local/bin/collect-profile-data' exists.assert_any_call(COLLECT_PROFILE_DATA) check_output.assert_any_call([COLLECT_PROFILE_DATA])
def test_benchmark_start_oserror(self, action_set): action_set.side_effect = OSError('File not found') self.assertFalse(Benchmark.start())