예제 #1
0
    def test_png_tag(self, param_test):
        (root) = param_test
        tag_attribs = all_tag_attrib_with_icon_number(root, TestLatestApi.icon_number, 'png/png', '1')
        value_of_attrib = attrib_value(tag_attribs, 'width')
        assert word_count(value_of_attrib) > 1

        value_of_attrib = attrib_value(tag_attribs, 'height')
        assert word_count(value_of_attrib) > 1

        value_of_attrib = attrib_value(tag_attribs, 'link')
        assert value_of_attrib[-4:] == '.png'
예제 #2
0
    def test_png_tag(self):
        tag_attribs = all_tag_attrib_with_icon_number(ContextIconsApi.response_root,
                                                      ContextIconsApi.icon_number, 'png/png', '1')
        value_of_attrib = attrib_value(tag_attribs, 'width')
        assert word_count(value_of_attrib) > 1

        value_of_attrib = attrib_value(tag_attribs, 'height')
        assert word_count(value_of_attrib) > 1

        value_of_attrib = attrib_value(tag_attribs, 'link')
        assert value_of_attrib[-4:] == '.png'
예제 #3
0
    def test_png_tag(self, param_test):
        (root) = param_test
        tag_attribs = all_tag_attrib(root, 'png/png', '1')
        value_of_attrib = attrib_value(tag_attribs, 'width')
        assert word_count(
            value_of_attrib) > 1, '>>> word count of "width" < 1 <<<'

        value_of_attrib = attrib_value(tag_attribs, 'height')
        assert word_count(
            value_of_attrib) > 1, '>>> word count of "height" < 1 <<<'

        value_of_attrib = attrib_value(tag_attribs, 'link')
        assert value_of_attrib[-4:] == '.png', '>>> link not end of ".png" <<<'
예제 #4
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")
예제 #5
0
 def test_nolink_tag(self, param_test):
     (root) = param_test
     if TestSimilarApi.icon_number == 0:
         pass
     else:
         value_of_tag = tag_value_with_icon_number(
             root, TestSimilarApi.icon_number, 'features/nolink', '1')
         assert word_count(value_of_tag) >= 1
예제 #6
0
    def test_term_random_tag(self, param_test):
        (root) = param_test
        tag_attribs = all_tag_attrib(root, 'term', ContextSuggestApi.term_number)
        value_of_attrib = attrib_value(tag_attribs, 'count')
        assert word_count(value_of_attrib) >= 1

        value_of_tag = tag_value(root, 'term', ContextSuggestApi.term_number)
        assert value_of_tag.lower().startswith(ContextSuggestApi.term)
예제 #7
0
 def test_categorychild_tag(self, param_test):
     (root) = param_test
     if TestSimilarApi.icon_number == 0:
         pass
     else:
         value_of_tag = tag_value_with_icon_number(
             root, TestSimilarApi.icon_number, 'categories/category', '1')
         assert word_count(value_of_tag) > 1
예제 #8
0
 def test_svg_tag(self, param_test):
     (root) = param_test
     if TestSimilarApi.icon_number == 0:
         pass
     else:
         value_of_tag = tag_value_with_icon_number(
             root, TestSimilarApi.icon_number, 'svg', '1')
         assert word_count(value_of_tag) > 1
예제 #9
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")
예제 #10
0
    def test_icon_tag(self):
        tag_attribs = all_tag_attrib(ContextIconsApi.response_root, 'icon', ContextIconsApi.icon_number)
        value_of_attrib = attrib_value(tag_attribs, 'id')
        assert word_count(value_of_attrib) >= 1

        value_of_attrib = attrib_value(tag_attribs, 'name')
        assert word_count(value_of_attrib) >= 1

        value_of_attrib = attrib_value(tag_attribs, 'platform')
        assert len(value_of_attrib)> 0

        value_of_attrib = attrib_value(tag_attribs, 'created')
        assert value_of_attrib[:2] == '20'

        value_of_attrib = attrib_value(tag_attribs, 'attributes')
        assert word_count(value_of_attrib) >= 0

        value_of_attrib = attrib_value(tag_attribs, 'url')
        assert "/icon/" in value_of_attrib
예제 #11
0
    def test_icon_tag(self, param_test):
        (root) = param_test
        tag_attribs = all_tag_attrib(root, 'icon', TestLatestApi.icon_number)
        value_of_attrib = attrib_value(tag_attribs, 'id')
        assert word_count(value_of_attrib) >= 1

        value_of_attrib = attrib_value(tag_attribs, 'name')
        assert word_count(value_of_attrib) > 1

        value_of_attrib = attrib_value(tag_attribs, 'platform')
        assert len(value_of_attrib) > 0

        value_of_attrib = attrib_value(tag_attribs, 'created')
        assert value_of_attrib[:2] == '20'

        value_of_attrib = attrib_value(tag_attribs, 'attributes')
        assert word_count(value_of_attrib) >= 0

        value_of_attrib = attrib_value(tag_attribs, 'url')
        assert "/icon/" in value_of_attrib
예제 #12
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")
예제 #13
0
    def test_icon_tag(self, param_test):
        (root) = param_test
        tag_attribs = all_tag_attrib(TestIconApi.response_root, 'icon', '1')
        value_of_attrib = attrib_value(tag_attribs, 'id')
        assert word_count(value_of_attrib) >= 1, '>>> word count of id = 0 <<<'

        value_of_attrib = attrib_value(tag_attribs, 'name')
        assert word_count(
            value_of_attrib) > 0, '>>> word count of name = 0 <<<'

        value_of_attrib = attrib_value(tag_attribs, 'platform')
        assert len(value_of_attrib) > 0

        value_of_attrib = attrib_value(tag_attribs, 'created')
        assert value_of_attrib[:
                               2] == '20', '>>> "created" not start from "20" <<<'

        value_of_attrib = attrib_value(tag_attribs, 'attributes')
        assert word_count(value_of_attrib) >= 0

        value_of_attrib = attrib_value(tag_attribs, 'url')
        assert "/icon/" in value_of_attrib, '>>> "url" not start from "/icon/" <<<'
예제 #14
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")
예제 #15
0
 def test_icons_count(self, param_test):
     (root) = param_test
     icons_current_count = 0
     x = True
     while x == True:
         try:
             icons_current_count += 1
             tag_attribs = all_tag_attrib(ContextSearchMinApi.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 <= TestSearchMinAPI.icon_count
         except AttributeError:
             x = False
             icons_current_count -= 1
             assert TestSearchMinAPI.icon_count >= icons_current_count
             assert icons_current_count > 0
예제 #16
0
 def test_category_tag(self, param_test):
     (root) = param_test
     value_of_tag = tag_value_with_icon_number(
         ContextSearchMinApi.response_root, TestSearchMinAPI.icon_number,
         'category', '1')
     assert word_count(value_of_tag) > 1
예제 #17
0
 def test_categorychild_tag(self, param_test):
     (root) = param_test
     value_of_tag = tag_value(root, 'categories/category', '1')
     assert word_count(
         value_of_tag
     ) > 1, '>>> word count of "categories/category" < 1 <<<'
예제 #18
0
 def test_nolink_tag(self, param_test):
     (root) = param_test
     value_of_tag = tag_value(root, 'nolink', '1')
     assert word_count(
         value_of_tag) >= 1, '>>> word count of "nolink" == 0 <<<'
예제 #19
0
 def test_vector_tag(self, param_test):
     (root) = param_test
     value_of_tag = tag_value(root, 'features/vector', '1')
     assert word_count(
         value_of_tag) >= 1, '>>> word count of "features/vector" == 0 <<<'
예제 #20
0
 def test_bitmap_tag(self, param_test):
     (root) = param_test
     value_of_tag = tag_value(root, 'bitmap', '1')
     assert word_count(
         value_of_tag) >= 1, '>>> word count of "bitmap" == 0  <<<'
예제 #21
0
 def test_categorychild_tag(self, param_test):
     (root) = param_test
     value_of_tag = tag_value_with_icon_number(
         TestSearchMaxAPI.response_root, TestSearchMaxAPI.icon_number,
         'categories/category', '1')
     assert word_count(value_of_tag) > 1
예제 #22
0
 def test_nolink_tag(self):
     value_of_tag = tag_value_with_icon_number(ContextIconsApi.response_root,
                                               ContextIconsApi.icon_number, 'features/nolink', '1')
     assert word_count(value_of_tag) >= 1
예제 #23
0
 def test_nolink_tag(self, param_test):
     (root) = param_test
     value_of_tag = tag_value_with_icon_number(root, TestLatestApi.icon_number, 'features/nolink', '1')
     assert word_count(value_of_tag) >= 1
예제 #24
0
 def test_nolink_tag(self, param_test):
     (root) = param_test
     value_of_tag = tag_value_with_icon_number(
         ContextSearchMinApi.response_root, TestSearchMinAPI.icon_number,
         'features/nolink', '1')
     assert word_count(value_of_tag) >= 1
예제 #25
0
 def test_svg_tag(self, param_test):
     (root) = param_test
     value_of_tag = tag_value(root, 'svg', '1')
     assert word_count(value_of_tag) > 1, '>>> word count of "svg" < 1 <<<'
예제 #26
0
 def test_vector_tag(self, param_test):
     (root) = param_test
     value_of_tag = tag_value_with_icon_number(
         TestSearchDefaultApi.response_root,
         TestSearchDefaultApi.icon_number, 'features/vector', '1')
     assert word_count(value_of_tag) >= 1
예제 #27
0
 def test_category_tag(self):
     value_of_tag = tag_value_with_icon_number(ContextIconsApi.response_root,
                                               ContextIconsApi.icon_number, 'category', '1')
     assert word_count(value_of_tag) > 1
예제 #28
0
 def test_category_tag(self, param_test):
     (root) = param_test
     value_of_tag = tag_value_with_icon_number(root, TestLatestApi.icon_number, 'category', '1')
     assert word_count(value_of_tag) > 1
예제 #29
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")
예제 #30
0
 def test_nolink_tag(self, param_test):
     (root) = param_test
     value_of_tag = tag_value_with_icon_number(
         TestSearchMaxAPI.response_root,
         TestSearchMaxAPI.icons_current_count, 'features/nolink', '1')
     assert word_count(value_of_tag) >= 1