Esempio n. 1
0
    def test_connect_fail(self, mock_connection):
        mock_connection.side_effect = UnauthorizedError()
        with assert_raises(UnauthorizedError):
            _connect("My token", "My host")

        mock_connection.assert_called_once_with("My host", "My token")
Esempio n. 2
0
    def test_connect(self, mock_connection):
        mock_connection.return_value = mock.create_autospec(Connection)
        c = _connect("My token", "My host")

        mock_connection.assert_called_once_with("My host", "My token")
        assert_true(c)
Esempio n. 3
0
    def test_connect_default_host(self, mock_connection):
        mock_connection.return_value = mock.create_autospec(Connection)
        c = _connect("My token")

        mock_connection.assert_called_once_with(settings.HOST, "My token")
        assert_true(c)
Esempio n. 4
0
    def test_connect(self, mock_connection):
        mock_connection.return_value = mock.create_autospec(Connection)
        c = _connect(self.host, self.token)

        mock_connection.assert_called_once_with(self.host, self.token)
        assert_true(c)
Esempio n. 5
0
    def test_connect_fail(self, mock_connection):
        mock_connection.side_effect = UnauthorizedError()
        with assert_raises(UnauthorizedError):
            _connect(self.host, self.token)

        mock_connection.assert_called_once_with(self.host, self.token)
Esempio n. 6
0
    def test_connect_fail(self, mock_connection):
        mock_connection.side_effect = UnauthorizedError()
        with assert_raises(UnauthorizedError):
            _connect('My token', 'My host')

        mock_connection.assert_called_once_with('My host', 'My token')
Esempio n. 7
0
    def test_connect_default_host(self, mock_connection):
        mock_connection.return_value = mock.create_autospec(Connection)
        c = _connect('My token')

        mock_connection.assert_called_once_with(settings.HOST, 'My token')
        assert_true(c)
Esempio n. 8
0
    def test_connect(self, mock_connection):
        mock_connection.return_value = mock.create_autospec(Connection)
        c = _connect('My token', 'My host')

        mock_connection.assert_called_once_with('My host', 'My token')
        assert_true(c)
Esempio n. 9
0
    def test_connect_fail(self, mock_connection):
        mock_connection.side_effect = UnauthorizedError()
        with assert_raises(UnauthorizedError):
            _connect(self.host, self.token)

        mock_connection.assert_called_once_with(self.host, self.token)
Esempio n. 10
0
    def test_connect(self, mock_connection):
        mock_connection.return_value = mock.create_autospec(Connection)
        c = _connect(self.host, self.token)

        mock_connection.assert_called_once_with(self.host, self.token)
        assert_true(c)