From 74ff217c7e8855c5ccf6dbc69cee0823cd65ee1b Mon Sep 17 00:00:00 2001 From: skyblue Date: Mon, 31 Mar 2014 13:30:32 +0800 Subject: [PATCH] add tests --- .gitignore | 13 ++++--------- tests/.travel.yml | 9 +++++++++ tests/README.md | 14 ++++++++++++++ tests/pyquick/test_index_rest.py | 13 +++++++++++++ 4 files changed, 40 insertions(+), 9 deletions(-) create mode 100644 tests/.travel.yml create mode 100644 tests/README.md create mode 100644 tests/pyquick/test_index_rest.py diff --git a/.gitignore b/.gitignore index cd9109b8d..158421d04 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,3 @@ -<<<<<<< HEAD - - -gogs -*.exe -*.exe~ .DS_Store *.db *.log @@ -14,8 +8,6 @@ data/ *.iml public/img/avatar/ -======= ->>>>>>> b4db9f67548a41922f1b337daf9c9d2b975b55c4 # Compiled Object files, Static and Dynamic libs (Shared Objects) *.o *.a @@ -37,4 +29,7 @@ _cgo_export.* _testmain.go -*.exe \ No newline at end of file +*.exe +*.exe~ +gogs +__pycache__ diff --git a/tests/.travel.yml b/tests/.travel.yml new file mode 100644 index 000000000..820621b28 --- /dev/null +++ b/tests/.travel.yml @@ -0,0 +1,9 @@ +command: python -m pytest {} +include: ^test_.*\.py$ +path: ./ +depth: 1 +verbose: true +timeout: 1m +reload: false +html: test.html +notify: [] diff --git a/tests/README.md b/tests/README.md new file mode 100644 index 000000000..aba7d388e --- /dev/null +++ b/tests/README.md @@ -0,0 +1,14 @@ +## gogs test + +this is for developers + +## prepare environment + # install python dependency + pip install pytest + # install basic test tool + go get -u github.com/shxsun/travelexec + # start gogs server + gogs web + +## start test + travelexec diff --git a/tests/pyquick/test_index_rest.py b/tests/pyquick/test_index_rest.py new file mode 100644 index 000000000..be0bf1830 --- /dev/null +++ b/tests/pyquick/test_index_rest.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python +# coding: utf-8 +# +# + +import requests + +HOST = 'http://localhost:3000' + +def test_index_get(): + r = requests.get(HOST + '/') + assert r.status_code == 200 +