11from __future__ import unicode_literals
22import os
33import time
4+ import pytest
45from algoliasearch .helpers import PY2
6+ from .helpers import is_community
57
68STR_TYPE = unicode if PY2 else str
79
810
11+ @pytest .mark .skipif (is_community ,
12+ reason = 'MCM methods cannot be tested by the community' )
913def uniq_user_id ():
1014 name = 'python-client'
1115 if 'TRAVIS' not in os .environ :
@@ -14,6 +18,8 @@ def uniq_user_id():
1418 return '{}-travis-{}' .format (name , job )
1519
1620
21+ @pytest .mark .skipif (is_community ,
22+ reason = 'MCM methods cannot be tested by the community' )
1723def test_1_list_clusters (mcm_client ):
1824 answer = mcm_client .list_clusters ()
1925
@@ -26,6 +32,8 @@ def test_1_list_clusters(mcm_client):
2632 assert isinstance (answer ['clusters' ][0 ]['dataSize' ], int )
2733
2834
35+ @pytest .mark .skipif (is_community ,
36+ reason = 'MCM methods cannot be tested by the community' )
2937def test_2_assign_user_id (mcm_client ):
3038 name = mcm_client .list_clusters ()['clusters' ][0 ]['clusterName' ]
3139 answer = mcm_client .assign_user_id (uniq_user_id (), name )
@@ -36,6 +44,8 @@ def test_2_assign_user_id(mcm_client):
3644 time .sleep (2 ) # Sleep to let the cluster publish the change
3745
3846
47+ @pytest .mark .skipif (is_community ,
48+ reason = 'MCM methods cannot be tested by the community' )
3949def test_3_list_user_ids (mcm_client ):
4050 answer = mcm_client .list_user_ids ()
4151
@@ -48,6 +58,8 @@ def test_3_list_user_ids(mcm_client):
4858 assert isinstance (answer ['userIDs' ][0 ]['dataSize' ], int )
4959
5060
61+ @pytest .mark .skipif (is_community ,
62+ reason = 'MCM methods cannot be tested by the community' )
5163def test_4_get_top_user_id (mcm_client ):
5264 cluster_name = mcm_client .list_clusters ()['clusters' ][0 ]['clusterName' ]
5365 answer = mcm_client .get_top_user_id ()
@@ -60,6 +72,9 @@ def test_4_get_top_user_id(mcm_client):
6072 assert isinstance (answer ['topUsers' ][cluster_name ][0 ]['nbRecords' ], int )
6173 assert isinstance (answer ['topUsers' ][cluster_name ][0 ]['dataSize' ], int )
6274
75+
76+ @pytest .mark .skipif (is_community ,
77+ reason = 'MCM methods cannot be tested by the community' )
6378def test_5_get_user_id (mcm_client ):
6479 answer = mcm_client .get_user_id (uniq_user_id ())
6580
@@ -69,6 +84,9 @@ def test_5_get_user_id(mcm_client):
6984 assert isinstance (answer ['nbRecords' ], int )
7085 assert isinstance (answer ['dataSize' ], int )
7186
87+
88+ @pytest .mark .skipif (is_community ,
89+ reason = 'MCM methods cannot be tested by the community' )
7290def test_6_search_user_ids (mcm_client ):
7391 clusterName = mcm_client .list_clusters ()['clusters' ][0 ]['clusterName' ]
7492 answer = mcm_client .search_user_ids (uniq_user_id (), clusterName , 0 , 1000 )
@@ -85,6 +103,9 @@ def test_6_search_user_ids(mcm_client):
85103 assert isinstance (answer ['hits' ][0 ]['nbRecords' ], int )
86104 assert isinstance (answer ['hits' ][0 ]['dataSize' ], int )
87105
106+
107+ @pytest .mark .skipif (is_community ,
108+ reason = 'MCM methods cannot be tested by the community' )
88109def test_7_remove_user_id (mcm_client ):
89110 answer = mcm_client .remove_user_id (uniq_user_id ())
90111
0 commit comments