예제 #1
0
 def test_create_event(self, event):
     event_controller = EventController()
     
     # Mocking upload inside EventController
     event_controller.upload_service = Mock()
     
     result = event_controller.create(event)
     assert result is True
예제 #2
0
파일: test_event.py 프로젝트: aeciovc/sda
    def test_create_event_with_none(self):
        event_controller = EventController()

        # Mocking db inside EventController
        event_controller.db = Mock()
        event_controller.upload_service = Mock()

        result = event_controller.create(None)
        assert result is False
예제 #3
0
파일: test_event.py 프로젝트: aeciovc/sda
    def test_create_event_with_upload_service_error(self, event):
        event_controller = EventController()

        event_controller.db = Mock()

        event_controller.upload_service = Mock()
        event_controller.upload_service.upload_from_url.side_effect = Exception

        result = event_controller.create(event.__dict__)
        assert result == (False, ConnectionRefusedError)
예제 #4
0
파일: test_event.py 프로젝트: aeciovc/sda
    def test_create_event_with_db_connection_error(self, event):
        event_controller = EventController()
        event_controller.db = Mock()
        event_controller.db.insert.side_effect = Exception

        event_controller.upload_service = Mock()

        result, excp = event_controller.create(event.__dict__)
        assert result == False
        assert excp == ConnectionError
예제 #5
0
def event_create():

    event = {
        "name": request.form['name'],
        "description": request.form['description'],
        "place": request.form['place'],
        "day": request.form['day'],
        "picture": request.form['picture'],
    }

    event_controller = EventController()

    result = event_controller.create(event)

    return {}, 201