Skip to content

Commit

Permalink
TESTS issue #4
Browse files Browse the repository at this point in the history
  • Loading branch information
zionhigt authored and zionhigt committed Mar 27, 2022
1 parent fbca741 commit 5393af0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
7 changes: 6 additions & 1 deletion tests/unit_test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@ def get_clubs():
def get_competitions():
return [
{
"name": "TEST_COMPETITION",
"name": "TEST_COMPETITION_1",
"date": "2020-03-27 10:00:00",
"numberOfPlaces": "25"
},
{
"name": "TEST_COMPETITION_2",
"date": "2025-03-27 10:00:00",
"numberOfPlaces": "25"
}
]

Expand Down
7 changes: 6 additions & 1 deletion tests/unit_test/mocks_files/fixture_load.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@
],
"competitions": [
{
"name": "TEST_COMPETITION",
"name": "TEST_COMPETITION_1",
"date": "2020-03-27 10:00:00",
"numberOfPlaces": "25"
},
{
"name": "TEST_COMPETITION_2",
"date": "2025-03-27 10:00:00",
"numberOfPlaces": "25"
}
]
}
13 changes: 10 additions & 3 deletions tests/unit_test/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,24 @@ def test_sould_not_purshase_more_than_I_own(self):
"club": cl.get('name'),
"competition": com.get('name'),
"places": int(cl.get('points')) + 1
}

}
response = self.client.post('/purchasePlaces', data=mock)
self.assertIn("You haven't enough of points to purshase this!", response.data.decode())
self.assertEqual(response.status_code, 403)

def test_sould_not_purshase_more_than_12_places(self):
response = self.client.post('/purchasePlaces', data={
"club": "TEST_CLUB",
"competition": "TEST_COMPETITION",
"competition": "TEST_COMPETITION_2",
"places": 13
})
self.assertIn("You cannot required more than 12 places!", response.data.decode())
self.assertEqual(response.status_code, 403)

def test_sould_not_purshase_booking_if_date_passed(self):
response = self.client.post('/purchasePlaces', data={
"club": "TEST_CLUB",
"competition": "TEST_COMPETITION_2",
"places": 1
})
self.assertEqual(response.status_code, 403)

0 comments on commit 5393af0

Please sign in to comment.