예제 #1
0
class ContextLatestApiJson(object):

    # icon id what will be in request

    amount = random_list_value(["5", "10", "20"])
    #platform = random_list_value(["win8", "ios7", "android", "gradient", "color", "win10", "office", "p1em"])
    platform = random_list_value(["win8", "ios7", "android", "color", "win10", "office"])
    offset = random_list_value(["5", "10", "15", "20"])
    impresser_preview = True
    language = 'en-US'

    print ('''Latest v3 Json tests: latform - %s, platform - %s, offset - %s, impresser_preview - %s, language - %s'''
           % (amount, platform, offset, impresser_preview, language))

    payload = {'amount': amount, 'platform': platform, 'offset': offset,
               'impresser_preview': impresser_preview, 'language': language}
    payload_auth = {'amount': amount, 'platform': platform, 'offset': offset,
                    'impresser_preview': impresser_preview, 'language': language, 'auth-id': auth_id}

    # Do Request and return response root
    response_root = request('latest', payload, "v3", "json")
    response_root_auth = request('latest', payload_auth, "v3", "json")

    # Action before class
    def setup_class(cls):
        print("\n>>> Class Setup")

    #  Action after class
    def teardown_class(cls):
        print("\n>>> Class Teardown")
예제 #2
0
class ContextTotalApi(object):

    # settings
    api_type = 'total'

    year = random_list_value(["14", "15", "16"])
    month = random_between_values(1, 12)
    day = random_between_values(1, 31)
    since = '20%s-%s-%s' % (year, month, day)
    payload = {'since': since}
    payload_auth = {'since': since, 'auth-id': auth_id}

    print('''Total v1 tests: since - %s''' % (since))

    icon_count = 100

    # Do Request and return response root
    response_root = request(api_type, payload, "v1", "xml")
    response_root_auth = request(api_type, payload_auth, "v1", "xml")

    # Action before class
    def setup_class(cls):
        print("\n>>> Class Setup")

    #  Action after class
    def teardown_class(cls):
        print("\n>>> Class Teardown")
예제 #3
0
class ContextCategoryv3ApiJson(object):

    # icon id what will be in request
    category = random_list_value(["Animals", "Sports", "Food", "Cinema"])
    amount = 10
    platform = random_list_value(
        ["win8", "ios7", "android", "androidL", "color", "win10", "office"])

    print(
        '''Category v3 Json tests: category - %s, amount - %s, platform - %s'''
        % (category, amount, platform))

    payload = {'category': category, 'amount': amount, 'platform': platform}
    payload_auth = {
        'category': category,
        'amount': amount,
        'platform': platform,
        'auth-id': auth_id
    }

    # Do Request and return response root
    response_root = request('category', payload, "v3", "json")
    response_root_auth = request('category', payload_auth, "v3", "json")

    # Action before class
    def setup_class(cls):
        print("\n>>> Class Setup")

    #  Action after class
    def teardown_class(cls):
        print("\n>>> Class Teardown")
class ContextCategoriesApiJson(object):

    # icon id what will be in request



    platform = random_list_value(["win8", "ios7", "android", "androidL","color", "win10", "office"])

    print ('''Categories v2 Json tests: platform - %s'''
           % (platform))

    payload = {'platform': platform}
    payload_auth = {'platform': platform, 'auth-id': auth_id}

    # Do Request and return response root
    response_root = request('categories', payload, "v2", "json")
    response_root_auth = request('categories', payload_auth, "v2", "json")

    # Action before class
    def setup_class(cls):
        print("\n>>> Class Setup")

    #  Action after class
    def teardown_class(cls):
        print("\n>>> Class Teardown")
예제 #5
0
class ContextSearchMinApi(object):

    #settings
    api_type = 'search'
    search_text = random_list_value(
        ['google', 'facebook', 'space', 'ball', 'car', 'word'])
    search_amount = '5'
    search_offset = '5'
    search_platform = random_list_value([""])
    search_language = ''
    payload = {
        'term': search_text,
        'amount': search_amount,
        'offset': search_offset,
        'platform': search_platform
    }

    payload_auth = {
        'term': search_text,
        'amount': search_amount,
        'offset': search_offset,
        'platform': search_platform,
        'auth-id': auth_id
    }

    print(
        '''Search min tests: term - %s, amount - %s , offset - %s, platform - %s'''
        % (search_text, search_amount, search_offset, search_platform))

    icon_count = 5

    # Do Request and return response root
    response_root = request(api_type, payload, "v1", "xml")
    response_root_auth = request(api_type, payload_auth, "v1", "xml")

    icons_current_count = 0
    x = True
    while x == True:
        try:
            icons_current_count += 1
            tag_attribs = all_tag_attrib(response_root, 'icon',
                                         str(icons_current_count))
            value_of_attrib = attrib_value(tag_attribs, 'id')
            assert word_count(value_of_attrib) >= 1
            assert icons_current_count <= icon_count
        except AttributeError:
            x = False
            icons_current_count -= 1

    # Choose random icon between min and max
    icon_number = str(random_between_values(1, icon_count))

    # Action before class
    def setup_class(cls):
        print("\n>>> Class Setup")

    #  Action after class
    def teardown_class(cls):
        print("\n>>> Class Teardown")
예제 #6
0
class ContextLatestApi(object):

    # settings
    api_type = 'latest'

    amount = random_list_value(["", "5", "10", "15", "20"])

    offset = random_list_value(["", "5", "10", "15", "20"])

    search_platform = random_list_value([
        "win8", "ios7", "android", "gradient", "color", "win10", "office",
        "p1em", ""
    ])

    print(
        '''Latest v1 tests: amount - %s, offset - %s, offset - %s, platform - %s'''
        % (amount, offset, offset, search_platform))

    payload = {'amount': amount, 'offset': offset, 'platform': search_platform}
    payload_auth = {
        'amount': amount,
        'offset': offset,
        'platform': search_platform,
        'auth-id': auth_id
    }

    icon_count = 100

    # Do Request and return response root
    response_root = request(api_type, payload, "v1", "xml")
    response_root_auth = request(api_type, payload_auth, "v1", "xml")

    icons_current_count = 0
    x = True
    while x == True:
        try:
            icons_current_count += 1
            tag_attribs = all_tag_attrib(response_root, 'icon',
                                         str(icons_current_count))
            value_of_attrib = attrib_value(tag_attribs, 'id')
            assert word_count(value_of_attrib) >= 1
            assert icons_current_count <= icon_count
        except AttributeError:
            x = False
            icons_current_count -= 1
            assert icons_current_count > 0

    # Choose random icon between min and max
    icon_number = str(random_between_values(1, icons_current_count))

    # Action before class
    def setup_class(cls):
        print("\n>>> Class Setup")

    #  Action after class
    def teardown_class(cls):
        print("\n>>> Class Teardown")
예제 #7
0
class ContextSuggestApi(object):

    #settings
    api_type = 'suggest'
    term = random_list_value(['google', 'facebook', 'space', 'ball', 'car'])
    amount = random_list_value(["", "5", "10", "15", "20"])
    platform = random_list_value(
        ["win8", "ios7", "android", "androidL", "color", "win10", "office"])
    payload = {'term': term, 'amount': amount, 'platform': platform}
    payload_auth = {
        'term': term,
        'amount': amount,
        'platform': platform,
        'auth-id': auth_id
    }

    print('''Suggest v1 tests: term - %s, amount - %s, platform - %s''' %
          (term, amount, platform))

    term_count = 25

    # Do Request and return response root
    response_root = request(api_type, payload, "v1", "xml")
    response_root_auth = request(api_type, payload_auth, "v1", "xml")

    term_current_count = 0
    x = True
    while x == True:
        try:
            term_current_count += 1
            tag_attribs = all_tag_attrib(response_root, 'suggests/term',
                                         str(term_current_count))
            value_of_attrib = attrib_value(tag_attribs, 'count')
            assert word_count(value_of_attrib) >= 1
            assert term_current_count <= term_count
        except AttributeError:
            x = False
            term_current_count -= 1
            assert term_current_count > 0
    # Choose random icon between min and max
    if term_current_count == 1:
        term_number = term_current_count
    else:
        term_number = str(random_between_values(2, term_current_count))

    # Action before class
    def setup_class(cls):
        print("\n>>> Class Setup")

    #  Action after class
    def teardown_class(cls):
        print("\n>>> Class Teardown")
예제 #8
0
class ContextSearchDefaultApi(object):

    #settings
    api_type = 'search'
    term = random_list_value(['google', 'facebook', 'car'])
    payload = {'term': term, 'amount': '', 'offset': '', 'platform': ''}
    payload_auth = {
        'term': term,
        'amount': '',
        'offset': '',
        'platform': '',
        'auth-id': auth_id
    }
    search_platform = random_list_value(
        ["win8", "android", "color", "win10", "office"])

    print(
        '''Search v1 default tests: term - %s, amount - %s , offset - %s, platform - %s'''
        % (term, '', '', ''))

    icon_count = 25

    # Do Request and return response root
    response_root = request(api_type, payload, "v1", "xml")
    response_root_auth = request(api_type, payload_auth, "v1", "xml")

    icons_current_count = 0
    x = True
    while x == True:
        try:
            icons_current_count += 1
            tag_attribs = all_tag_attrib(response_root, 'icon',
                                         str(icons_current_count))
            value_of_attrib = attrib_value(tag_attribs, 'id')
            assert word_count(value_of_attrib) >= 1
            assert icons_current_count <= icon_count
        except AttributeError:
            x = False
            icons_current_count -= 1
            assert icons_current_count > 0

    # Choose random icon between min and max
    icon_number = str(random_between_values(1, icon_count))

    # Action before class
    def setup_class(cls):
        print("\n>>> Class Setup")

    #  Action after class
    def teardown_class(cls):
        print("\n>>> Class Teardown")
예제 #9
0
class ContextIconApiJson(object):

    # Settings
    # icon id what will be in request
    icon_id = random.choice([
        str(random_between_values(0, 7500)),
        str(random_between_values(9500, 20000))
    ])

    format = "json"
    files = "eps,svg"
    variants = "enabled"
    info = "enabled"

    print(
        '''Icon v2 Json tests: id - %s, files - %s, variants - %s, info - %s'''
        % (icon_id, files, variants, info))

    payload = {
        'id': icon_id,
        'format': format,
        'files': files,
        'variants': variants,
        'info': info
    }
    payload_auth = {
        'id': icon_id,
        'format': format,
        'files': files,
        'variants': variants,
        'info': info,
        'auth-id': auth_id
    }

    # Do Request and return response root
    response_root = request('icon', payload, "v2", "json")
    response_root_auth = request('icon', payload_auth, "v2", "json")

    # Action before class
    def setup_class(cls):
        print("\n>>> Class Setup")

    #  Action after class
    def teardown_class(cls):
        print("\n>>> Class Teardown")
예제 #10
0
class ContextCategoryv3ApiJson(object):

    # icon id what will be in request
    term = random_list_value(
        ["Animals", "Sports", "Food", "Cinema", "Cultures"])
    amount = 10
    platform = random_list_value([
        "win8", "ios7", "android", "gradient", "color", "win10", "office",
        "p1em"
    ])
    offset = 10

    print(
        '''Search v3 Json tests: term - %s, amount - %s, platform - %s, offset - %s'''
        % (term, amount, platform, offset))

    payload = {
        'term': term,
        'amount': amount,
        'platform': platform,
        'offset': offset
    }
    payload_auth = {
        'term': term,
        'amount': amount,
        'platform': platform,
        'offset': offset,
        'auth-id': auth_id
    }

    # Do Request and return response root
    response_root = request('search', payload, "v3", "json")
    response_root_auth = request('search', payload_auth, "v3", "json")

    # Action before class
    def setup_class(cls):
        print("\n>>> Class Setup")

    #  Action after class
    def teardown_class(cls):
        print("\n>>> Class Teardown")
예제 #11
0
class ContextTotalApiJson(object):

    # icon id what will be in request
    year = random_list_value(["14", "15", "16"])
    month = random_between_values(1, 12)
    day = random_between_values(1, 31)
    since = '20%s-%s-%s' % (year, month, day)
    print('''Total v2 Json tests: since - %s''' % (since))
    payload = {'since': since}
    payload_auth = {'since': since, 'auth-id': auth_id}

    # Do Request and return response root
    response_root = request('total', payload, "v3", "json")
    response_root_auth = request('total', payload_auth, "v3", "json")

    # Action before class
    def setup_class(cls):
        print("\n>>> Class Setup")

    #  Action after class
    def teardown_class(cls):
        print("\n>>> Class Teardown")
예제 #12
0
class ContextCategoriesApi(object):

    # settings
    api_type = 'categories'

    search_platform = random_list_value([
        "win8", "ios7", "android", "androidL", "color", "win10", "office", ""
    ])

    print('''Categories v1 Json tests: search_platform - %s''' %
          (search_platform))
    payload = {'platform': search_platform}
    payload_auth = {'platform': search_platform, 'auth-id': auth_id}

    response_root = request(api_type, payload, "v1", "xml")
    response_root_auth = request(api_type, payload, "v1", "xml")

    # Action before class
    def setup_class(cls):
        print("\n>>> Class Setup")

    #  Action after class
    def teardown_class(cls):
        print("\n>>> Class Teardown")
예제 #13
0
class ContextIconApi(object):

    # Settings
    # icon id what will be in request
    icon_id = random.choice([str(random_between_values(1, 7500)),
                             str(random_between_values(9500, 20000))])

    print ('''Icon v1 tests: id - %s'''
           % icon_id)

    payload = {'id': icon_id}
    payload_auth = {'id': icon_id, 'auth-id': auth_id}

    # Do Request and return response root
    response_root = request('icon', payload, "v1", "xml")
    response_root_auth = request('icon', payload_auth, "v1", "xml")

    # Action before class
    def setup_class(cls):
        print("\n>>> Class Setup")

    #  Action after class
    def teardown_class(cls):
        print("\n>>> Class Teardown")
예제 #14
0
class ContextListApi(object):

    # settings
    api_type = 'list'

    search_platform = random_list_value(
        ["android", "gradient", "color", "win10", ""])

    print('''List v1 tests: search_platform - %s''' % search_platform)
    payload = {'platform': search_platform, 'auth-id': auth_id}

    response_root = request(api_type, payload, "v1", "xml")

    # Action before class
    def setup_class(cls):
        print("\n>>> Class Setup")

    #  Action after class
    def teardown_class(cls):
        print("\n>>> Class Teardown")
예제 #15
0
class ContextCategoryApi(object):

    # settings
    api_type = 'category'

    category = random_list_value(
        ["City", "Food", "Travel", "Transport", "Weather"])
    amount = random_list_value(["", "5", "10", "15", "20"])
    offset = random_list_value(["", "5", "10", "15", "20"])
    platform = random_list_value(
        ["win8", "ios7", "android", "androidL", "color", "win10", "office"])
    attributes = ''

    payload = {
        'category': category,
        'amount': amount,
        'offset': offset,
        'platform': platform,
        'attributes': attributes
    }
    payload_auth = {
        'category': category,
        'amount': amount,
        'offset': offset,
        'platform': platform,
        'attributes': attributes,
        'auth-id': auth_id
    }

    print(
        '''Category v1 tests: category - %s, amount - %s , offset - %s, platform - %s, attributes - %s'''
        % (category, amount, offset, platform, attributes))

    icon_count = 100

    # Do Request and return response root
    response_root = request(api_type, payload, "v1", "xml")
    response_root_auth = request(api_type, payload_auth, "v1", "xml")

    icons_current_count = 0
    x = True
    while x is True:
        try:
            icons_current_count += 1
            tag_attribs = all_tag_attrib(response_root, 'icon',
                                         str(icons_current_count))
            value_of_attrib = attrib_value(tag_attribs, 'id')
            assert word_count(value_of_attrib) >= 1
            assert icons_current_count <= icon_count
        except AttributeError:
            x = False
            icons_current_count -= 1
            assert icons_current_count > 0

    # Choose random icon between min and max
    icon_number = str(random_between_values(1, icons_current_count))

    # Action before class
    def setup_class(cls):
        print("\n>>> Class Setup")

    #  Action after class
    def teardown_class(cls):
        print("\n>>> Class Teardown")