コード例 #1
0
    def test_getCollectionError(self):
        # Arrange
        self.requester = Requester('*****@*****.**', 'password',
                                   'organizationId')
        self.requester.requests = MockRequests(400)

        # Act/Assert
        with self.assertRaisesRegex(
                Exception, 'Get collection request returned 400 code'):
            self.requester.getCollection("collectionId")
コード例 #2
0
    def test_getOrganizationsError(self):
        # Arrange
        self.requester = Requester('*****@*****.**', 'password',
                                   'organizationId')
        self.requester.requests = MockRequests(500)

        # Act/Assert
        with self.assertRaisesRegex(
                Exception, 'Get organizations request returned 500 code'):
            self.requester.getOrganizations()
コード例 #3
0
    def test_addTagToCardError(self):
        # Arrange
        self.requester = Requester('*****@*****.**', 'password',
                                   'organizationId')
        self.requester.requests = MockRequests(500)

        # Act/Assert
        with self.assertRaisesRegex(Exception,
                                    'Update card request returned 500 code'):
            self.requester.addTagToCard("256", "987")
コード例 #4
0
    def test_addColumnToBoardError(self):
        # Arrange
        self.requester = Requester('*****@*****.**', 'password',
                                   'organizationId')
        self.requester.requests = MockRequests(404)

        # Act/Assert
        with self.assertRaisesRegex(Exception,
                                    'Post column request returned 404 code'):
            self.requester.addColumnToBoard("columnName", "fakeBoardId")
コード例 #5
0
    def test_getTagByNameError(self):
        # Arrange
        self.requester = Requester('*****@*****.**', 'password',
                                   'organizationId')
        self.requester.requests = MockRequests(404)

        # Act/Assert
        with self.assertRaisesRegex(Exception,
                                    'Get tag request returned 404 code'):
            self.requester.getTagByName("tagName")
コード例 #6
0
    def test_createBoardError(self):
        # Arrange
        self.requester = Requester('*****@*****.**', 'password',
                                   'organizationId')
        self.requester.requests = MockRequests(404)

        # Act/Assert
        with self.assertRaisesRegex(Exception,
                                    'Post board request returned 404 code'):
            self.requester.createBoard("boardName", "fakeCollectionId")
コード例 #7
0
    def test_getOrganizationsSuccess(self):
        # Arrange
        self.requester = Requester('*****@*****.**', 'password',
                                   'organizationId')
        self.requester.requests = MockRequests(200)

        # Act
        result = self.requester.getOrganizations()

        # Assert
        self.assertEqual(self.requester.requests.auth, self.auth)
        self.assertEqual(self.requester.requests.url,
                         'https://favro.com/api/v1/organizations')
コード例 #8
0
    def test_getCardByIdSuccess(self):
        # Arrange
        self.requester = Requester('*****@*****.**', 'password',
                                   'organizationId')
        self.requester.requests = MockRequests(200)

        # Act
        result = self.requester.getCardById("156")

        # Assert
        self.assertEqual(self.requester.requests.auth, self.auth)
        self.assertEqual(self.requester.requests.url,
                         'https://favro.com/api/v1/cards/156')
        self.assertEqual(self.requester.requests.headers,
                         {'organizationId': 'organizationId'})
コード例 #9
0
    def test_addTagToCardSuccess(self):
        # Arrange
        self.requester = Requester('*****@*****.**', 'password',
                                   'organizationId')
        self.requester.requests = MockRequests(200)

        # Act
        result = self.requester.addTagToCard("156", "987")

        # Assert
        self.assertEqual(self.requester.requests.auth, self.auth)
        self.assertEqual(self.requester.requests.url,
                         'https://favro.com/api/v1/cards/156')
        self.assertEqual(self.requester.requests.headers,
                         {'organizationId': 'organizationId'})
        self.assertEqual(self.requester.requests.data, {'addTagIds': ['987']})
コード例 #10
0
    def test_getTagByNameSuccess(self):
        # Arrange
        self.requester = Requester('*****@*****.**', 'password',
                                   'organizationId')
        self.requester.requests = MockRequests(200)

        # Act
        result = self.requester.getTagByName("tagName")

        # Assert
        self.assertEqual(self.requester.requests.auth, self.auth)
        self.assertEqual(self.requester.requests.url,
                         'https://favro.com/api/v1/tags')
        self.assertEqual(self.requester.requests.headers,
                         {'organizationId': 'organizationId'})
        self.assertEqual(self.requester.requests.data, {'name': 'tagName'})
コード例 #11
0
    def test_getWidgetsSuccess(self):
        # Arrange
        self.requester = Requester('*****@*****.**', 'password',
                                   'organizationId')
        self.requester.requests = MockRequests(200)

        # Act
        result = self.requester.getWidgets("fakeCollectionId")

        # Assert
        self.assertEqual(self.requester.requests.auth, self.auth)
        self.assertEqual(self.requester.requests.url,
                         'https://favro.com/api/v1/widgets')
        self.assertEqual(self.requester.requests.headers,
                         {'organizationId': 'organizationId'})
        self.assertEqual(self.requester.requests.data,
                         {'collectionId': 'fakeCollectionId'})
コード例 #12
0
    def test_addColumnToBoardSuccess(self):
        # Arrange
        self.requester = Requester('*****@*****.**', 'password',
                                   'organizationId')
        self.requester.requests = MockRequests(201)

        # Act
        result = self.requester.addColumnToBoard("columnName", "fakeBoardId")

        # Assert
        self.assertEqual(self.requester.requests.auth, self.auth)
        self.assertEqual(self.requester.requests.url,
                         'https://favro.com/api/v1/columns')
        self.assertEqual(self.requester.requests.headers,
                         {'organizationId': 'organizationId'})
        self.assertEqual(self.requester.requests.data, {
            'widgetCommonId': 'fakeBoardId',
            'name': 'columnName'
        })
コード例 #13
0
    def test_createBoardSuccess(self):
        # Arrange
        self.requester = Requester('*****@*****.**', 'password',
                                   'organizationId')
        self.requester.requests = MockRequests(201)

        # Act
        result = self.requester.createBoard("boardName", "fakeCollectionId")

        # Assert
        self.assertEqual(self.requester.requests.auth, self.auth)
        self.assertEqual(self.requester.requests.url,
                         'https://favro.com/api/v1/widgets')
        self.assertEqual(self.requester.requests.headers,
                         {'organizationId': 'organizationId'})
        self.assertEqual(
            self.requester.requests.data, {
                'collectionId': 'fakeCollectionId',
                'name': 'boardName',
                'type': 'board'
            })