Skip to content

Commit

Permalink
Fixing the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
asmasma21 committed Jan 2, 2015
1 parent c868bb7 commit 2782fb1
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def test_index(self):
assert rv.status_code == 200

def test_add_new_category(self):
self.app.get("/test_login")
rv = self.app.post('/addCategory', data=dict(
name='test'), follow_redirects=True)
assert "Category added succefully" in rv.data
Expand All @@ -40,6 +41,7 @@ def test_only_logged_users_can_add_new_category(self):
assert 'Unauthorized' in rv.data

def test_add_existing_category(self):
self.app.get("/test_login")
self.app.post('/addCategory', data=dict(
name='test'), follow_redirects=True)

Expand All @@ -48,6 +50,7 @@ def test_add_existing_category(self):
assert "This Categorie already exists !" in rv.data

def test_update_category(self):
self.app.get("/test_login")
self.app.post('/addCategory', data=dict(
name='test'), follow_redirects=True)

Expand All @@ -74,7 +77,7 @@ def test_only_logged_users_can_update_category(self):
@unittest.expectedFailure
def test_update_category_with_existing_name(self):


self.app.get("/test_login")
self.app.post('/addCategory', data=dict(
name='test'), follow_redirects=True)

Expand All @@ -88,7 +91,7 @@ def test_update_category_with_existing_name(self):
assert "Category updated succefully" in rv.data

def test_update_uncategorised_category(self):

self.app.get("/test_login")
self.app.get('/init')

c = CategoryModel.query.filter(CategoryModel.name=="Uncategorised").first()
Expand All @@ -99,6 +102,7 @@ def test_update_uncategorised_category(self):


def test_delete_category(self):
self.app.get("/test_login")
self.app.post('/addCategory', data=dict(
name='test'), follow_redirects=True)

Expand All @@ -123,8 +127,8 @@ def test_only_logged_users_can_delete_category(self):
assert 'Unauthorized' in rv.data

def test_delete_uncategorised_category(self):
self.app.get("/test_login")
self.app.get('/init')

c = CategoryModel.query.filter(CategoryModel.name=="Uncategorised").first()

rv = self.app.post('/deletecategory', data=dict(
Expand All @@ -134,6 +138,7 @@ def test_delete_uncategorised_category(self):

@unittest.expectedFailure
def test_add_new_slide_with_valid_url(self):
self.app.get("/test_login")
self.app.post('/addCategory', data=dict(
name='test'), follow_redirects=True)

Expand All @@ -151,6 +156,7 @@ def test_add_new_slide_with_valid_url(self):
assert "Slide added succefully" in rv.data

def test_add_new_slide_with_non_github_url(self):
self.app.get("/test_login")
self.app.post('/addCategory', data=dict(
name='test'), follow_redirects=True)

Expand All @@ -167,6 +173,7 @@ def test_add_new_slide_with_non_github_url(self):

@unittest.expectedFailure
def test_add_new_slide_with_non_gh_pages_branch(self):
self.app.get("/test_login")
self.app.post('/addCategory', data=dict(
name='test'), follow_redirects=True)

Expand Down

0 comments on commit 2782fb1

Please sign in to comment.