Revision 9d4502a8 snf-pithos-tools/pithos/tools/test.py

b/snf-pithos-tools/pithos/tools/test.py
59 59
                "%A, %d-%b-%y %H:%M:%S GMT",
60 60
                "%a, %d %b %Y %H:%M:%S GMT"]
61 61

  
62
OTHER_ACCOUNTS = {
63
    '0001': 'verigak',
64
    '0002': 'chazapis',
65
    '0003': 'gtsouk',
66
    '0004': 'papagian',
67
    '0005': 'louridas',
68
    '0006': 'chstath',
69
    '0007': 'pkanavos',
70
    '0008': 'mvasilak',
71
    '0009': 'διογένης'}
62
from pithos.api.settings import AUTHENTICATION_USERS
63
AUTHENTICATION_USERS = AUTHENTICATION_USERS or {}
64
OTHER_ACCOUNTS = AUTHENTICATION_USERS.copy()
65
OTHER_ACCOUNTS.pop(get_auth())
72 66

  
73 67
class BaseTestCase(unittest.TestCase):
74 68
    #TODO unauthorized request
......
123 117

  
124 118
    def _clean_account(self):
125 119
        for c in self.client.list_containers():
126
            if c not in self.initial_containers:
120
#             if c not in self.initial_containers:
127 121
                self.client.delete_container(c, delimiter='/')
128 122
                self.client.delete_container(c)
129 123
    
......
298 292

  
299 293
    def test_get_account_meta_until(self):
300 294
        t = datetime.datetime.utcnow()
301
        past = t - datetime.timedelta(minutes=-15)
295
        past = t - datetime.timedelta(minutes=15)
302 296
        past = int(_time.mktime(past.timetuple()))
303 297

  
304 298
        meta = {'premium':True}
......
913 907
        v_meta = self.client.retrieve_object_metadata(c, o['name'],
914 908
                                                      restricted=True,
915 909
                                                      version=v)
916
        for k in meta.keys():
917
            self.assertTrue(k not in v_meta)
918

  
910
        (self.assertTrue(k not in v_meta) for k in meta.keys())
911
        
919 912
        #update obejct
920 913
        data = get_random_data()
921 914
        self.client.update_object(c, o['name'], StringIO(data))
922

  
915
        
923 916
        aa = self.client.retrieve_object_versionlist(c, o['name'])['versions']
924 917
        self.assert_versionlist_structure(aa)
925 918
        self.assertEqual(len(a)+1, len(aa))
......
1862 1855
        for i in range(2):
1863 1856
            self.upload_random_data('c1', 'o%s' %i)
1864 1857
        accounts = OTHER_ACCOUNTS.copy()
1865
        self.o1_sharing_with = accounts.popitem()
1866
        self.o1_sharing = [self.o1_sharing_with[1]]
1867
        self.client.share_object('c1', 'o1', self.o1_sharing, read=True)
1868

  
1858
        self.o1_sharing = accounts.popitem()
1859
        self.client.share_object('c1', 'o1', (self.o1_sharing[1],), read=True)
1860
        
1869 1861
        l = []
1870
        for i in range(2):
1862
        for i in range(len(OTHER_ACCOUNTS) - 1):
1871 1863
            l.append(accounts.popitem())
1872

  
1864
    
1865
    def tearDown(self):
1866
        pass
1867
    
1873 1868
    def test_list_other_shared(self):
1874 1869
        self.other = Pithos_Client(get_url(),
1875
                              self.o1_sharing_with[0],
1876
                              self.o1_sharing_with[1])
1870
                              self.o1_sharing[0],
1871
                              self.o1_sharing[1])
1877 1872
        self.assertTrue(get_user() in self.other.list_shared_by_others())
1878 1873

  
1879 1874
    def test_list_my_shared(self):

Also available in: Unified diff