def test_move_on_deck_card(self): data = get_project_webhook_data() project_handler = self._get_project_handler(data) project_handler.session.request.return_value.json.return_value = { 'url': 'https://api.github.com/projects/columns/2001376', 'project_url': 'https://api.github.com/projects/1206552', 'cards_url': 'https://api.github.com/projects/columns/2001376/cards', 'id': 2001376, 'name': 'On Deck', 'created_at': '2018-01-11T19:36:33Z', 'updated_at': '2018-01-17T17:46:36Z' } project_handler.run() # an on deck card will sync! project_handler.sync_on_deck.assert_called_with()
def test_move_on_deck_card(self): data = get_project_webhook_data() project_handler = self._get_project_handler(data) project_handler.session.request.return_value.json.return_value = { "url": "https://api.github.com/projects/columns/2001376", "project_url": "https://api.github.com/projects/1206552", "cards_url": "https://api.github.com/projects/columns/2001376/cards", "id": 2001376, "name": "On Deck", "created_at": "2018-01-11T19:36:33Z", "updated_at": "2018-01-17T17:46:36Z", } project_handler.run() # an on deck card will sync! project_handler.sync_on_deck.assert_called_with()
def test_project_call(self, *mocks): """ Ensure the project action is called """ data = get_project_webhook_data() client = APIClient() url = reverse("webhook-list") response = client.post(url, data, format="json") self.assertEquals(200, response.status_code) handlers_mock = mocks[0] handlers_mock.handler_types.get.assert_called_with("project") handler = handlers_mock.handler_types.get.return_value handler.assert_called_with(data) handler.return_value.run.assert_called_with()
def test_get_action_type_project(self): data = get_project_webhook_data() action_type = get_action_type(data) self.assertEquals('project', action_type)