def test_it_should_log_stdout_when_executing_change(self, run_isql_mock, write_temporary_file_mock): execution_log = Mock() virtuoso = Virtuoso(self.config) virtuoso.execute_change("sparql_up", "sparql_down", execution_log) execution_log.assert_called_with("output")
def test_it_should_write_a_file_with_sparql_up_when_executing_change(self, run_isql_mock, write_temporary_file_mock): virtuoso = Virtuoso(self.config) virtuoso.execute_change("sparql_up", "sparql_down") write_temporary_file_mock.assert_called_with("set echo on;\nsparql_up", "file_up") run_isql_mock.assert_called_with('filename.ttl', True)
def test_it_should_delete_the_temporary_file_with_sparql_up_when_executing_change(self, run_isql_mock, write_temporary_file_mock): create_file('filename.ttl', 'content') virtuoso = Virtuoso(self.config) virtuoso.execute_change("sparql_up", "sparql_down") self.assertFalse(os.path.exists('filename.ttl'))
def test_it_should_write_a_file_with_sparql_up_when_executing_change(self, command_call_mock, write_temporary_file_mock): virtuoso = Virtuoso(self.config) virtuoso.execute_change("sparql_up", "sparql_down") write_temporary_file_mock.assert_called_with("set echo on;\nsparql_up", "file_up") command_call_mock.assert_called_with('isql -U user -P password -H localhost -S 9999 < filename.ttl')