This commit is contained in:
tdurieux
2017-10-27 11:00:43 +02:00
parent 3233266dd2
commit 056cd26219
2 changed files with 45 additions and 3 deletions

View File

@@ -1,6 +1,11 @@
language: python
python:
- "2.7"
- "3.2"
- '2.7'
- '3.2'
install:
- pip install -r requirements.txt
- pip install -r requirements.txt
script:
- python -m unittest discover
env:
global:
secure: PKmngr3eae91tw8QAWhG4u2Ad9sstHde5Q/1GObRXcH6Ky7AD+u1bekOWztLZCdmF83/FA4fDTMJK+7+GN1jtqnJCxpVd8jGcCzxdnP3ILIB5R6u9RNSQaQdnJ+mnC0wEXtHML4MTGJ331B1bttyo66XfEWz2szrB9u4Uic0HpexPoBnCD/zmmv+HJjVkZAC4KpAQmO6/JrMg3QFet2NBEnPl5wU33pxJ/SdbQl+A75Eqlix8bfs8yfapHhm9qKrfCCB90lMqaLVdSoYmzLo2WLv6TR+uAszzEe6YzglzXFlKFIm2h9+7ftCmRAJAHybEp/JjDhFvp4xD6svaLfbEFy1Ng6a447lGekike4a176QNs0jKxS+pf+TYzBVDJo+GhRZ1HESmOhCuESZcGZpFke1iQzcCZOR9jlgdjeahe6IiyHF2QgrX5NyJm7l7XvRaSv6jIhrCOAKvysxOV9YNr59wQu1nMWpuv9+LhrJ6bKgBqJkkmayVoSmnA5I8a219IA2WLWCDtZWfgiWWE1GW1J/t+P0YD/6mX71gPmLMymxK+vw+z6cfhQvgPBYllEk7cjDywXOajm54IE0s8lcmj9uGUJ21F6kLBLudAUTQbN4HCMMiSvemY069XzVvIhOTJy0OAYTdwbsXg6MOuCpf9n2S4vr1xC2cOkO62GXu7A=

37
test.py Normal file
View File

@@ -0,0 +1,37 @@
import os
import unittest
import tempfile
import uuid
import shutil
from server import Anonymous_Github
class FlaskrTestCase(unittest.TestCase):
def setUp(self):
self.temp_db_location = tempfile.mkdtemp()
self.app = Anonymous_Github(github_token="", config_dir=self.temp_db_location).application.test_client()
def tearDown(self):
shutil.rmtree(self.temp_db_location)
def create_repository(self, url, terms):
anonymous_id = uuid.uuid4()
self.app.post("/?id=%s" % anonymous_id, data={
'githubRepository': url,
'terms': terms
})
return anonymous_id
def test_index(self):
rv = self.app.get("/")
assert "<title>GitHub Anonymous</title>" in rv.data
def test_create_repository(self):
anonymous_id = self.create_repository("https://github.com/tdurieux/anonymous_github/", "github")
rv = self.app.get("/repository/%s/" % anonymous_id)
assert "Anonymous XXX" in rv.data
if __name__ == '__main__':
unittest.main()