summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMikhail Galanin <mgalanin@mimecast.com>2018-09-21 09:56:11 +0100
committerMikhail Galanin <mgalanin@mimecast.com>2018-09-21 09:56:11 +0100
commit90c979e64ea862c3a2c3e14aefe5a49c893d65cd (patch)
tree4e9c1d27b7372634221191e10d39114c8297fe18 /test
parent0b0cad929f07ac90b065678be21af15da0e065f8 (diff)
downloadrspamd-90c979e64ea862c3a2c3e14aefe5a49c893d65cd.tar.gz
rspamd-90c979e64ea862c3a2c3e14aefe5a49c893d65cd.zip
[Test] Use init_url() frim the new helper
Diffstat (limited to 'test')
-rw-r--r--test/lua/unit/lua_util.extract_specific_urls.lua12
-rw-r--r--test/lua/unit/selectors.lua13
-rw-r--r--test/lua/unit/url.lua8
3 files changed, 7 insertions, 26 deletions
diff --git a/test/lua/unit/lua_util.extract_specific_urls.lua b/test/lua/unit/lua_util.extract_specific_urls.lua
index 1eaa88187..210e0370c 100644
--- a/test/lua/unit/lua_util.extract_specific_urls.lua
+++ b/test/lua/unit/lua_util.extract_specific_urls.lua
@@ -4,19 +4,11 @@ context("Lua util - extract_specific_urls", function()
local fun = require "fun"
local url = require "rspamd_url"
local logger = require "rspamd_logger"
- local ffi = require "ffi"
local rspamd_util = require "rspamd_util"
local rspamd_task = require "rspamd_task"
+ local test_helper = require "rspamd_test_helper"
- ffi.cdef[[
- void rspamd_url_init (const char *tld_file);
- unsigned ottery_rand_range(unsigned top);
- void rspamd_http_normalize_path_inplace(char *path, size_t len, size_t *nlen);
- ]]
-
- local test_dir = string.gsub(debug.getinfo(1).source, "^@(.+/)[^/]+$", "%1")
-
- ffi.C.rspamd_url_init(string.format('%s/%s', test_dir, "test_tld.dat"))
+ test_helper.init_url_parser()
local task_object = {
urls = {},
diff --git a/test/lua/unit/selectors.lua b/test/lua/unit/selectors.lua
index 5454f35d4..9b3f950ea 100644
--- a/test/lua/unit/selectors.lua
+++ b/test/lua/unit/selectors.lua
@@ -3,20 +3,11 @@ context("Selectors test", function()
local rspamd_task = require "rspamd_task"
local logger = require "rspamd_logger"
local lua_selectors = require "lua_selectors"
- local ffi = require "ffi"
+ local test_helper = require "rspamd_test_helper"
local cfg = rspamd_config
-
local task
-
- ffi.cdef[[
- void rspamd_url_init (const char *tld_file);
- unsigned ottery_rand_range(unsigned top);
- void rspamd_http_normalize_path_inplace(char *path, size_t len, size_t *nlen);
- ]]
- local test_dir = string.gsub(debug.getinfo(1).source, "^@(.+/)[^/]+$", "%1")
-
- ffi.C.rspamd_url_init(string.format('%s/%s', test_dir, "test_tld.dat"))
+ test_helper.init_url_parser()
before(function()
local res
diff --git a/test/lua/unit/url.lua b/test/lua/unit/url.lua
index 902744c2e..a748c4de8 100644
--- a/test/lua/unit/url.lua
+++ b/test/lua/unit/url.lua
@@ -4,16 +4,14 @@ context("URL check functions", function()
local mpool = require("rspamd_mempool")
local url = require("rspamd_url")
local logger = require("rspamd_logger")
+ local test_helper = require("rspamd_test_helper")
local ffi = require("ffi")
+
ffi.cdef[[
- void rspamd_url_init (const char *tld_file);
- unsigned ottery_rand_range(unsigned top);
void rspamd_http_normalize_path_inplace(char *path, size_t len, size_t *nlen);
]]
- local test_dir = string.gsub(debug.getinfo(1).source, "^@(.+/)[^/]+$", "%1")
-
- ffi.C.rspamd_url_init(string.format('%s/%s', test_dir, "test_tld.dat"))
+ test_helper.init_url_parser()
local pool = mpool.create()