forked from galaxyproject/galaxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
104 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,23 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
""" | ||
import os | ||
import datetime | ||
import imp | ||
import unittest | ||
import os | ||
import random | ||
import datetime | ||
import unittest | ||
|
||
test_utils = imp.load_source( 'test_utils', | ||
os.path.join( os.path.dirname( __file__), '../unittest_utils/utility.py' ) ) | ||
|
||
from sqlalchemy import true | ||
from sqlalchemy import false | ||
from sqlalchemy import desc | ||
from sqlalchemy import column, desc, false, true | ||
from sqlalchemy.sql import text | ||
from sqlalchemy import column | ||
|
||
from base import BaseTestCase | ||
from base import CreatesCollectionsMixin | ||
|
||
from galaxy.managers import collections, hdas, history_contents | ||
from galaxy.managers.histories import HistoryManager | ||
from galaxy.managers import hdas | ||
from galaxy.managers import collections | ||
from galaxy.managers import history_contents | ||
|
||
from .base import BaseTestCase | ||
from .base import CreatesCollectionsMixin | ||
|
||
default_password = '123456' | ||
user2_data = dict( email='[email protected]', username='user2', password=default_password ) | ||
|
@@ -62,10 +57,10 @@ def test_contents( self ): | |
self.assertEqual( [], list( self.contents_manager.contents( history ) ) ) | ||
|
||
self.log( "calling contents on an history with hdas should return those in order of their hids" ) | ||
hdas = [ self.add_hda_to_history( history, name=( 'hda-' + str( x ) ) ) for x in xrange( 3 ) ] | ||
hdas = [ self.add_hda_to_history( history, name=( 'hda-' + str( x ) ) ) for x in range( 3 ) ] | ||
random.shuffle( hdas ) | ||
ordered_hda_contents = list( self.contents_manager.contents( history ) ) | ||
self.assertEqual( map( lambda hda: hda.hid, ordered_hda_contents ), [ 1, 2, 3 ] ) | ||
self.assertEqual( [hda.hid for hda in ordered_hda_contents], [ 1, 2, 3 ] ) | ||
|
||
self.log( "calling contents on an history with both hdas and collections should return both" ) | ||
hdca = self.add_list_collection_to_history( history, hdas ) | ||
|
@@ -80,7 +75,7 @@ def test_contained( self ): | |
self.assertEqual( [], list( self.contents_manager.contained( history ) ) ) | ||
|
||
self.log( "calling contained on an history with both hdas and collections should return only hdas" ) | ||
hdas = [ self.add_hda_to_history( history, name=( 'hda-' + str( x ) ) ) for x in xrange( 3 ) ] | ||
hdas = [ self.add_hda_to_history( history, name=( 'hda-' + str( x ) ) ) for x in range( 3 ) ] | ||
self.add_list_collection_to_history( history, hdas ) | ||
self.assertEqual( list( self.contents_manager.contained( history ) ), hdas ) | ||
|
||
|
@@ -92,7 +87,7 @@ def test_subcontainers( self ): | |
self.assertEqual( [], list( self.contents_manager.subcontainers( history ) ) ) | ||
|
||
self.log( "calling subcontainers on an history with both hdas and collections should return only collections" ) | ||
hdas = [ self.add_hda_to_history( history, name=( 'hda-' + str( x ) ) ) for x in xrange( 3 ) ] | ||
hdas = [ self.add_hda_to_history( history, name=( 'hda-' + str( x ) ) ) for x in range( 3 ) ] | ||
hdca = self.add_list_collection_to_history( history, hdas ) | ||
subcontainers = list( self.contents_manager.subcontainers( history ) ) | ||
self.assertEqual( subcontainers, [ hdca ] ) | ||
|
@@ -101,9 +96,9 @@ def test_limit_and_offset( self ): | |
user2 = self.user_manager.create( **user2_data ) | ||
history = self.history_manager.create( name='history', user=user2 ) | ||
contents = [] | ||
contents.extend([ self.add_hda_to_history( history, name=( 'hda-' + str( x ) ) ) for x in xrange( 3 ) ]) | ||
contents.extend([ self.add_hda_to_history( history, name=( 'hda-' + str( x ) ) ) for x in range( 3 ) ]) | ||
contents.append( self.add_list_collection_to_history( history, contents[:3] ) ) | ||
contents.extend([ self.add_hda_to_history( history, name=( 'hda-' + str( x ) ) ) for x in xrange( 4, 6 ) ]) | ||
contents.extend([ self.add_hda_to_history( history, name=( 'hda-' + str( x ) ) ) for x in range( 4, 6 ) ]) | ||
contents.append( self.add_list_collection_to_history( history, contents[4:6] ) ) | ||
|
||
# _subquery = self.contents_manager._contents_common_query( self.contents_manager.subcontainer_class, history.id ) | ||
|
@@ -130,9 +125,9 @@ def test_orm_filtering( self ): | |
user2 = self.user_manager.create( **user2_data ) | ||
history = self.history_manager.create( name='history', user=user2 ) | ||
contents = [] | ||
contents.extend([ self.add_hda_to_history( history, name=( 'hda-' + str( x ) ) ) for x in xrange( 3 ) ]) | ||
contents.extend([ self.add_hda_to_history( history, name=( 'hda-' + str( x ) ) ) for x in range( 3 ) ]) | ||
contents.append( self.add_list_collection_to_history( history, contents[:3] ) ) | ||
contents.extend([ self.add_hda_to_history( history, name=( 'hda-' + str( x ) ) ) for x in xrange( 4, 6 ) ]) | ||
contents.extend([ self.add_hda_to_history( history, name=( 'hda-' + str( x ) ) ) for x in range( 4, 6 ) ]) | ||
contents.append( self.add_list_collection_to_history( history, contents[4:6] ) ) | ||
|
||
self.log( "should allow filter on deleted" ) | ||
|
@@ -207,9 +202,9 @@ def test_order_by( self ): | |
user2 = self.user_manager.create( **user2_data ) | ||
history = self.history_manager.create( name='history', user=user2 ) | ||
contents = [] | ||
contents.extend([ self.add_hda_to_history( history, name=( 'hda-' + str( x ) ) ) for x in xrange( 3 ) ]) | ||
contents.extend([ self.add_hda_to_history( history, name=( 'hda-' + str( x ) ) ) for x in range( 3 ) ]) | ||
contents.append( self.add_list_collection_to_history( history, contents[:3] ) ) | ||
contents.extend([ self.add_hda_to_history( history, name=( 'hda-' + str( x ) ) ) for x in xrange( 4, 6 ) ]) | ||
contents.extend([ self.add_hda_to_history( history, name=( 'hda-' + str( x ) ) ) for x in range( 4, 6 ) ]) | ||
contents.append( self.add_list_collection_to_history( history, contents[4:6] ) ) | ||
|
||
self.log( "should default to hid order_by" ) | ||
|
@@ -240,9 +235,9 @@ def test_update_time_filter( self ): | |
user2 = self.user_manager.create( **user2_data ) | ||
history = self.history_manager.create( name='history', user=user2 ) | ||
contents = [] | ||
contents.extend([ self.add_hda_to_history( history, name=( 'hda-' + str( x ) ) ) for x in xrange( 3 ) ]) | ||
contents.extend([ self.add_hda_to_history( history, name=( 'hda-' + str( x ) ) ) for x in range( 3 ) ]) | ||
contents.append( self.add_list_collection_to_history( history, contents[:3] ) ) | ||
contents.extend([ self.add_hda_to_history( history, name=( 'hda-' + str( x ) ) ) for x in xrange( 4, 6 ) ]) | ||
contents.extend([ self.add_hda_to_history( history, name=( 'hda-' + str( x ) ) ) for x in range( 4, 6 ) ]) | ||
contents.append( self.add_list_collection_to_history( history, contents[4:6] ) ) | ||
|
||
self.log( "should allow filtering by update_time" ) | ||
|
@@ -264,9 +259,9 @@ def test_filtered_counting( self ): | |
user2 = self.user_manager.create( **user2_data ) | ||
history = self.history_manager.create( name='history', user=user2 ) | ||
contents = [] | ||
contents.extend([ self.add_hda_to_history( history, name=( 'hda-' + str( x ) ) ) for x in xrange( 3 ) ]) | ||
contents.extend([ self.add_hda_to_history( history, name=( 'hda-' + str( x ) ) ) for x in range( 3 ) ]) | ||
contents.append( self.add_list_collection_to_history( history, contents[:3] ) ) | ||
contents.extend([ self.add_hda_to_history( history, name=( 'hda-' + str( x ) ) ) for x in xrange( 4, 6 ) ]) | ||
contents.extend([ self.add_hda_to_history( history, name=( 'hda-' + str( x ) ) ) for x in range( 4, 6 ) ]) | ||
contents.append( self.add_list_collection_to_history( history, contents[4:6] ) ) | ||
|
||
self.log( "should show correct count with filters" ) | ||
|
@@ -292,9 +287,9 @@ def test_type_id( self ): | |
user2 = self.user_manager.create( **user2_data ) | ||
history = self.history_manager.create( name='history', user=user2 ) | ||
contents = [] | ||
contents.extend([ self.add_hda_to_history( history, name=( 'hda-' + str( x ) ) ) for x in xrange( 3 ) ]) | ||
contents.extend([ self.add_hda_to_history( history, name=( 'hda-' + str( x ) ) ) for x in range( 3 ) ]) | ||
contents.append( self.add_list_collection_to_history( history, contents[:3] ) ) | ||
contents.extend([ self.add_hda_to_history( history, name=( 'hda-' + str( x ) ) ) for x in xrange( 4, 6 ) ]) | ||
contents.extend([ self.add_hda_to_history( history, name=( 'hda-' + str( x ) ) ) for x in range( 4, 6 ) ]) | ||
contents.append( self.add_list_collection_to_history( history, contents[4:6] ) ) | ||
|
||
self.log( "should be able to use eq and in with hybrid type_id" ) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,24 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
""" | ||
import os | ||
import imp | ||
import os | ||
import unittest | ||
|
||
test_utils = imp.load_source( 'test_utils', | ||
os.path.join( os.path.dirname( __file__), '../unittest_utils/utility.py' ) ) | ||
import galaxy_mock | ||
|
||
import sqlalchemy | ||
from six import string_types | ||
from sqlalchemy import true | ||
|
||
from galaxy import model | ||
from galaxy import exceptions | ||
|
||
from base import BaseTestCase | ||
from galaxy import exceptions, model | ||
from galaxy.managers import base, hdas | ||
from galaxy.managers.histories import (HistoryDeserializer, HistoryFilters, | ||
HistoryManager, HistorySerializer) | ||
|
||
from galaxy.managers import base | ||
from galaxy.managers.histories import HistoryManager | ||
from galaxy.managers.histories import HistorySerializer | ||
from galaxy.managers.histories import HistoryDeserializer | ||
from galaxy.managers.histories import HistoryFilters | ||
from galaxy.managers import hdas | ||
from .base import BaseTestCase | ||
|
||
default_password = '123456' | ||
user2_data = dict( email='[email protected]', username='user2', password=default_password ) | ||
|
@@ -260,7 +256,7 @@ def test_sharable( self ): | |
len( self.history_manager.get_share_assocs( item1 ) ), 1 ) | ||
self.assertEqual( | ||
len( self.history_manager.get_share_assocs( item1, user=non_owner ) ), 1 ) | ||
self.assertIsInstance( item1.slug, basestring ) | ||
self.assertIsInstance( item1.slug, string_types ) | ||
|
||
self.log( "should be able to unshare with specific users" ) | ||
share_assoc = self.history_manager.unshare_with( item1, non_owner ) | ||
|
@@ -491,7 +487,7 @@ def test_history_serializers( self ): | |
|
||
self.log( 'everything serialized should be of the proper type' ) | ||
self.assertIsInstance( serialized[ 'size' ], int ) | ||
self.assertIsInstance( serialized[ 'nice_size' ], basestring ) | ||
self.assertIsInstance( serialized[ 'nice_size' ], string_types ) | ||
|
||
self.log( 'serialized should jsonify well' ) | ||
self.assertIsJsonifyable( serialized ) | ||
|
@@ -560,7 +556,7 @@ def test_contents( self ): | |
self.assertEqual( serialized[ 'state_details' ][ 'ok' ], 1 ) | ||
self.assertIsInstance( serialized[ 'state_ids' ][ 'ok' ], list ) | ||
self.assertIsInstance( serialized[ 'hdas' ], list ) | ||
self.assertIsInstance( serialized[ 'hdas' ][0], basestring ) | ||
self.assertIsInstance( serialized[ 'hdas' ][0], string_types ) | ||
|
||
serialized = self.history_serializer.serialize( history1, [ 'contents' ] ) | ||
self.assertHasKeys( serialized[ 'contents' ][0], [ 'id', 'name', 'peek', 'create_time' ]) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.