Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #281

Open
wants to merge 15 commits into
base: develop
Choose a base branch
from
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

[Orientdb](http://www.orientechnologies.com/) driver for python that uses the binary protocol.

Pyorient works with orientdb version 1.7 and later.
Pyorient works with orientdb versions from 1.7 to 2.x.
> **Warning** Some issues are experimented with record_create/record_upload and OrientDB < 2.0. These command are strongly discouraged with these versions

> **NOTICE** Prior to version 1.4.9 there was a potential SQL injection vulnerability that now is fixed.
Expand All @@ -19,6 +19,10 @@ Pyorient works with orientdb version 1.7 and later.

pip install pyorient

## Documentation

[OrientDB PyOrient Python Driver](http://orientdb.com/docs/last/PyOrient.html)

## How to contribute

- Fork the project
Expand All @@ -32,7 +36,7 @@ Pyorient works with orientdb version 1.7 and later.
## How to run tests

- ensure you have `ant` and `nose` installed properly
- bootsrap orient by running `./ci/ci-start.sh` from project directory
- bootstrap orient by running `./ci/start-ci.sh` from project directory
*it will download latest orient and make some change on config and database for the tests*
- run with `nosetests`

Expand Down Expand Up @@ -317,6 +321,10 @@ for food in animal_foods:
- [mogui](https://github.com/mogui/)
- [ostico](https://github.com/ostico/)

## Thanks
To **Jetbrains** tools support, coded with:
[<img src="https://i.imgur.com/LcUZzzW.png" width="70"/>](https://www.jetbrains.com/)

## Copyright

Copyright (c) 2014 Niko Usai, Domenico Lupinetti. See LICENSE for details.
2 changes: 1 addition & 1 deletion ci/start-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -e

PARENT_DIR=$(dirname $(cd "$(dirname "$0")"; pwd))
CI_DIR="$PARENT_DIR/ci/environment"
DEFAULT_ORIENT_VERSION="2.1.5"
DEFAULT_ORIENT_VERSION="2.2.33"

# launch simple instance in debug mode with shell hang up
while [ $# -ne 0 ]; do
Expand Down
2 changes: 1 addition & 1 deletion pyorient/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
NAME = "OrientDB Python binary client (pyorient)"
VERSION = "1.5.5b"
SUPPORTED_PROTOCOL = 36
SUPPORTED_PROTOCOL = 37

#
# Binary Types
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from setuptools import setup

setup(name='pyorient',
version='1.5.4',
version='1.5.5',
author='Niko Usai <[email protected]>, Domenico Lupinetti <[email protected]>',
description='OrientDB native client library',
long_description=open('README.rst').read(),
Expand Down
33 changes: 10 additions & 23 deletions tests/test_token_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ def setUp(self):
self.client = pyorient.OrientDB("localhost", 2424)
client = pyorient.OrientDB("localhost", 2424)
client.connect("root", "root")
client.db_open( 'GratefulDeadConcerts', 'admin', 'admin' )
if client._connection.protocol < 26:
self.skipTest("Token not supported in OrientDB < 2.0")

if client._connection.protocol > 32:
self.skipTest("Token not well supported in OrientDB >= 2.2.0")
if client._connection.protocol >= 32 and client.version.build < 4:
self.skipTest("Token not well supported in OrientDB >= 2.2.0 and < 2.2.4")

def testPrepareConnection(self):
global old_token
Expand Down Expand Up @@ -75,40 +76,26 @@ def testRenewAuthToken(self):
client.set_session_token( True )
client.db_open( "GratefulDeadConcerts", "admin", "admin" )
res1 = client.record_load("#9:1")
res2 = client.query( 'select from V where @rid = #9:1' )

self.assertEqual(
res1.oRecordData['name'],
res2[0].oRecordData['name']
)
self.assertEqual(
res1.oRecordData['out_sung_by'].get_hash(),
res2[0].oRecordData['out_sung_by'].get_hash()
)
self.assertEqual(
res1.oRecordData['out_written_by'].get_hash(),
res2[0].oRecordData['out_written_by'].get_hash()
)

actual_token = client.get_session_token()
del client

# create a new client
client = pyorient.OrientDB("localhost", 2424)
client.set_session_token( actual_token )
res3 = client.query( 'select from V where @rid = #9:1' )
res3 = client.record_load("#9:1")

self.assertEqual(
res2[0].oRecordData['name'],
res3[0].oRecordData['name']
res1.oRecordData['name'],
res3.oRecordData['name']
)
self.assertEqual(
res2[0].oRecordData['out_sung_by'].get_hash(),
res3[0].oRecordData['out_sung_by'].get_hash()
res1.oRecordData['out_sung_by'].get_hash(),
res3.oRecordData['out_sung_by'].get_hash()
)
self.assertEqual(
res2[0].oRecordData['out_written_by'].get_hash(),
res3[0].oRecordData['out_written_by'].get_hash()
res1.oRecordData['out_written_by'].get_hash(),
res3.oRecordData['out_written_by'].get_hash()
)

# set the flag again to true if you want to renew the token
Expand Down