Move public repo test to pytest

This commit is contained in:
Joseph Schorr 2018-07-18 17:22:05 -04:00
parent a830d53212
commit 2d7b4dd1bf
2 changed files with 8 additions and 32 deletions

View file

@ -1,32 +0,0 @@
import unittest
from datetime import timedelta
from app import app
from initdb import setup_database_for_testing, finished_database_for_testing
from data import model
PUBLIC_USERNAME = 'public'
PUBLIC_REPONAME = 'publicrepo'
class TestRepoModel(unittest.TestCase):
def setUp(self):
setup_database_for_testing(self)
self.app = app.test_client()
self.ctx = app.test_request_context()
self.ctx.__enter__()
def tearDown(self):
finished_database_for_testing(self)
self.ctx.__exit__(True, None, None)
def test_popular_repo_list(self):
onlypublic = model.repository.list_popular_public_repos(0, timedelta(weeks=1))
self.assertEquals(len(onlypublic), 1)
self.assertEquals(onlypublic[0], (PUBLIC_USERNAME, PUBLIC_REPONAME))
if __name__ == '__main__':
unittest.main()