Skip to content

Commit

Permalink
updated unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tikazyq committed Jun 5, 2022
1 parent 2718d6a commit 94f5a02
Show file tree
Hide file tree
Showing 15 changed files with 11 additions and 31 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
30 changes: 0 additions & 30 deletions _ext/python/crawlab/models/spider.py

This file was deleted.

Empty file removed _ext/python/legacy/db/__init__.py
Empty file.
12 changes: 11 additions & 1 deletion _ext/python/test/cli_action/upload_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,16 @@ def test_upload(self):

def test_upload_with_crawlab_json(self):
name, dir_path = self._setup()
description = 'test_description_' + f'_{int(datetime.now().timestamp())}'
mode = 'all-nodes'
priority = 1
cmd = 'echo hello'
param = 'test'
with open(os.path.join(dir_path, 'main.py'), 'w') as f:
f.write('print(\'hello world\')')
with open(os.path.join(dir_path, 'crawlab.json'), 'w') as f:
f.write('{"name":"%s"}' % name)
f.write('{"name":"%s","description":"%s","mode":"%s","priority":%d,"cmd":"%s","param":"%s"}' % (
name, description, mode, priority, cmd, param))
login(Namespace(
username='admin',
password='admin',
Expand All @@ -94,6 +100,10 @@ def test_upload_with_crawlab_json(self):
assert len(data) == 10
spider = data[0]
assert spider.get('name') == name
assert spider.get('description') == description
assert spider.get('mode') == mode
assert spider.get('cmd') == cmd
assert spider.get('param') == param
requests.delete(f'{self.endpoint}/spiders/{spider.get("_id")}',
headers={'Authorization': config.data.get("token")})

Expand Down

0 comments on commit 94f5a02

Please sign in to comment.