Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Commit

Permalink
Add test for manually closed gates
Browse files Browse the repository at this point in the history
  • Loading branch information
redvox committed Apr 27, 2016
1 parent 9934528 commit ea2fafc
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ def setUpClass(cls):
cls.ticketNotFound = TicketNotFound().message
cls.jsonStructureError = JsonStructureError().message

cls.api_helper = ApiHelper(environment) # TODO fix environment?
cls.database_helper = DatabaseHelper(environment) # TODO fix environment?
cls.api_helper = ApiHelper(environment) # TODO fix environment?
cls.database_helper = DatabaseHelper(environment) # TODO fix environment?
cls.testdata_helper = TestDataHelper(cls.api_helper)

cls.keys_develop_state = ['environments', 'develop', 'state']
Expand Down Expand Up @@ -132,7 +132,6 @@ def test_api_create_new_gate_with_same_name_in_different_groups(self):
self.assertEqual(response['name'], service)
self.assertEqual(response['group'], new_group)


def test_api_create_empty_gate(self):
gate_data = {
'environments': []
Expand Down Expand Up @@ -620,6 +619,16 @@ def test_api_test_and_set_queue_in(self, mongo_mock):
self.assertEqual(response['status'], 'ok', response)
self.assertEqual(response['ticket']["expiration_date"], self.an_hour_from_now)

@mock.patch('app.api.blueprint.mongo.get_expiration_date')
def test_api_test_and_set_queue_denied_if_closed_manually(self, mongo_mock):
mongo_mock.return_value = self.an_hour_from_now

service, group, set_data = self.testdata_helper.prepare_test_and_set_data()
self.api_helper.close_gate(group, service, "develop")

response = self.api_helper.set_gate(set_data)
self.assertEqual(response['status'], 'denied')

def test_api_switch_non_existing_group(self):
service, group = self.testdata_helper.create_default_gate()
response = self.api_helper.open_gate('zzzzzZZZZZzzzZZZ', service, 'develop')
Expand Down

0 comments on commit ea2fafc

Please sign in to comment.