Project

General

Profile

« Previous | Next » 

Revision 5aef54c8

Added by koszko over 1 year ago

make "uuid" an optional property

View differences:

test/haketilo_test/unit/test_item_preview.py
37 37
    execute_in_page(load_script('html/item_preview.js'))
38 38

  
39 39
    sample_resource = make_sample_resource()
40
    uuid = sample_resource['uuid']
40 41

  
41 42
    preview_div = execute_in_page(
42 43
        '''
......
48 49
    text = preview_div.text
49 50

  
50 51
    assert '...' not in text
52
    assert 'not set' not in text
51 53

  
52 54
    for string in [
53 55
            *filter(lambda v: type(v) is str, sample_resource.values()),
54 56
            *[rr['identifier'] for rr in sample_resource['dependencies']],
55 57
            *[c['file'] for k in ('source_copyright', 'scripts')
56 58
              for c in sample_resource[k]],
57
            item_version_string(sample_resource, True)
59
            item_version_string(sample_resource, True), uuid
58 60
    ]:
59 61
        assert string in text
60 62

  
63
    del sample_resource['uuid']
61 64
    sample_resource['identifier'] = 'hellopear'
62 65
    sample_resource['long_name'] = 'Hello Pear'
63 66
    sample_resource['description'] = 'greets a pear'
......
73 76
        sample_resource)
74 77
    text = preview_div.text
75 78

  
76
    for string in ['...', 'pple', 'hello-message', 'report.spdx',
79
    for string in [uuid, '...', 'pple', 'hello-message', 'report.spdx',
77 80
                   'LICENSES/CC0-1.0.txt', 'hello.js', 'bye.js']:
78 81
        assert string not in text
79 82

  
80 83
    for string in ['hellopear', 'Hello Pear', 'hello-msg', 'greets a pear',
81
                   'report_spdx', 'LICENSES/CC0-1_0_txt', 'hello_js', 'bye_js']:
84
                   'report_spdx', 'LICENSES/CC0-1_0_txt', 'hello_js', 'bye_js',
85
                   'not set']:
82 86
        assert string in text
83 87

  
84 88
@pytest.mark.ext_data({
......
93 97
    execute_in_page(load_script('html/item_preview.js'))
94 98

  
95 99
    sample_mapping = make_sample_mapping()
100
    uuid = sample_mapping['uuid']
96 101

  
97 102
    preview_div = execute_in_page(
98 103
        '''
......
104 109
    text = preview_div.text
105 110

  
106 111
    assert '...' not in text
112
    assert 'not set' not in text
107 113

  
108 114
    for string in [
109 115
            *filter(lambda v: type(v) is str, sample_mapping.values()),
110 116
            *[p['identifier'] for p in sample_mapping['payloads'].values()],
111 117
            *[c['file'] for c in sample_mapping['source_copyright']],
112
            item_version_string(sample_mapping)
118
            item_version_string(sample_mapping), uuid
113 119
    ]:
114 120
        assert string in text
115 121

  
122
    del sample_mapping['uuid']
116 123
    sample_mapping['identifier'] = 'example-org-bloated'
117 124
    sample_mapping['long_name'] = 'Example.org Bloated',
118 125
    sample_mapping['payloads'] = dict(
......
129 136
        sample_mapping)
130 137
    text = preview_div.text
131 138

  
132
    for string in ['...', 'inimal', 'example.org', 'report.spdx',
139
    for string in [uuid, '...', 'inimal', 'example.org', 'report.spdx',
133 140
                   'LICENSES/CC0-1.0.txt']:
134 141
        assert string not in text
135 142

  
136 143
    for string in ['example-org-bloated', 'Example.org Bloated', 'example.com',
137
                   'report_spdx', 'LICENSES/CC0-1_0_txt']:
144
                   'report_spdx', 'LICENSES/CC0-1_0_txt', 'not set']:
138 145
        assert string in text
139 146

  
140 147
@pytest.mark.ext_data({

Also available in: Unified diff