コード例 #1
0
 def test_load_specification_row_empty_resources(self):
     scraped_data = self.empty_scrape()
     scraped_spec = {
         'section.note': '',
         'section.subpath': '',
         'section.name': '',
         'specification.mdn_key': 'CSS3 UI',
         'section.id': None,
         'specification.id': None}
     scraped_data['specs'].append(scraped_spec)
     view = ScrapedViewFeature(self.page, scraped_data)
     out = view.generate_data()
     spec_content, mat_content = view.new_specification(scraped_spec)
     section_content = view.new_section(scraped_spec, spec_content['id'])
     # TODO: bug 1251252 - Empty string should mean omittied name, subpath
     section_content['name']['en'] = ''
     section_content['subpath']['en'] = ''
     reference_content = view.load_or_new_reference(section_content['id'])
     reference_content['note'] = None
     expected = self.empty_view(scraped_data)
     expected['features']['links']['references'] = [reference_content['id']]
     expected['linked']['maturities'] = [mat_content]
     expected['linked']['specifications'] = [spec_content]
     expected['linked']['sections'] = [section_content]
     expected['linked']['references'] = [reference_content]
     self.assertDataEqual(expected, out)
コード例 #2
0
ファイル: test_scrape.py プロジェクト: yyinhai/browsercompat
 def test_load_specification_row_empty_resources(self):
     scraped_data = self.empty_scrape()
     scraped_spec = {
         'section.note': '',
         'section.subpath': '',
         'section.name': '',
         'specification.mdn_key': 'CSS3 UI',
         'section.id': None,
         'specification.id': None
     }
     scraped_data['specs'].append(scraped_spec)
     view = ScrapedViewFeature(self.page, scraped_data)
     out = view.generate_data()
     spec_content, mat_content = view.new_specification(scraped_spec)
     section_content = view.new_section(scraped_spec, spec_content['id'])
     # TODO: bug 1251252 - Empty string should mean omittied name, subpath
     section_content['name']['en'] = ''
     section_content['subpath']['en'] = ''
     reference_content = view.load_or_new_reference(section_content['id'])
     reference_content['note'] = None
     expected = self.empty_view(scraped_data)
     expected['features']['links']['references'] = [reference_content['id']]
     expected['linked']['maturities'] = [mat_content]
     expected['linked']['specifications'] = [spec_content]
     expected['linked']['sections'] = [section_content]
     expected['linked']['references'] = [reference_content]
     self.assertDataEqual(expected, out)
コード例 #3
0
ファイル: test_scrape.py プロジェクト: yyinhai/browsercompat
 def test_new_specification(self):
     spec_row = {
         'section.note': 'section note',
         'section.subpath': '#section',
         'section.name': 'section',
         'specification.mdn_key': 'CSS3 UI',
         'section.id': None,
         'specification.id': None
     }
     view = ScrapedViewFeature(self.page, self.empty_scrape())
     spec_content, mat_content = view.new_specification(spec_row)
     expected_spec = {
         'id': '_CSS3 UI',
         'mdn_key': 'CSS3 UI',
         'links': {
             'maturity': '_unknown'
         }
     }
     self.assertDataEqual(expected_spec, spec_content)
     expected_mat = {
         'id': '_unknown',
         'slug': '',
         'name': {
             'en': 'Unknown'
         },
         'links': {
             'specifications': []
         }
     }
     self.assertDataEqual(expected_mat, mat_content)
コード例 #4
0
ファイル: test_scrape.py プロジェクト: renoirb/browsercompat
 def test_new_specification(self):
     spec_row = {
         "section.note": "section note",
         "section.subpath": "#section",
         "section.name": "section",
         "specification.mdn_key": "CSS3 UI",
         "section.id": None,
         "specification.id": None,
     }
     view = ScrapedViewFeature(self.page, self.empty_scrape())
     spec_content, mat_content = view.new_specification(spec_row)
     expected_spec = {"id": "_CSS3 UI", "mdn_key": "CSS3 UI", "links": {"maturity": "_unknown", "sections": []}}
     self.assertDataEqual(expected_spec, spec_content)
     expected_mat = {"id": "_unknown", "slug": "", "name": {"en": "Unknown"}, "links": {"specifications": []}}
     self.assertDataEqual(expected_mat, mat_content)
コード例 #5
0
 def test_new_specification(self):
     spec_row = {
         'section.note': 'section note',
         'section.subpath': '#section',
         'section.name': 'section',
         'specification.mdn_key': 'CSS3 UI',
         'section.id': None,
         'specification.id': None}
     view = ScrapedViewFeature(self.page, self.empty_scrape())
     spec_content, mat_content = view.new_specification(spec_row)
     expected_spec = {
         'id': '_CSS3 UI', 'mdn_key': 'CSS3 UI',
         'links': {'maturity': '_unknown'}}
     self.assertDataEqual(expected_spec, spec_content)
     expected_mat = {
         'id': '_unknown', 'slug': '', 'name': {'en': 'Unknown'},
         'links': {'specifications': []}}
     self.assertDataEqual(expected_mat, mat_content)
コード例 #6
0
ファイル: test_scrape.py プロジェクト: willkg/browsercompat
 def test_load_specification_row_new_resources(self):
     scraped_data = self.empty_scrape()
     scraped_spec = {
         'section.note': 'section note',
         'section.subpath': '#section',
         'section.name': 'section',
         'specification.mdn_key': 'CSS3 UI',
         'section.id': None,
         'specification.id': None}
     scraped_data['specs'].append(scraped_spec)
     view = ScrapedViewFeature(self.page, scraped_data)
     out = view.generate_data()
     spec_content, mat_content = view.new_specification(scraped_spec)
     section_content = view.new_section(scraped_spec, spec_content['id'])
     expected = self.empty_view(scraped_data)
     expected['features']['links']['sections'] = [section_content['id']]
     expected['linked']['maturities'] = [mat_content]
     expected['linked']['specifications'] = [spec_content]
     expected['linked']['sections'] = [section_content]
     self.assertDataEqual(expected, out)
コード例 #7
0
 def test_load_specification_row_new_resources(self):
     scraped_data = self.empty_scrape()
     scraped_spec = {
         'section.note': 'section note',
         'section.subpath': '#section',
         'section.name': 'section',
         'specification.mdn_key': 'CSS3 UI',
         'section.id': None,
         'specification.id': None
     }
     scraped_data['specs'].append(scraped_spec)
     view = ScrapedViewFeature(self.page, scraped_data)
     out = view.generate_data()
     spec_content, mat_content = view.new_specification(scraped_spec)
     section_content = view.new_section(scraped_spec, spec_content['id'])
     expected = self.empty_view(scraped_data)
     expected['features']['links']['sections'] = [section_content['id']]
     expected['linked']['maturities'] = [mat_content]
     expected['linked']['specifications'] = [spec_content]
     expected['linked']['sections'] = [section_content]
     self.assertDataEqual(expected, out)
コード例 #8
0
ファイル: test_scrape.py プロジェクト: renoirb/browsercompat
 def test_load_specification_row_new_resources(self):
     scraped_data = self.empty_scrape()
     scraped_spec = {
         "section.note": "section note",
         "section.subpath": "#section",
         "section.name": "section",
         "specification.mdn_key": "CSS3 UI",
         "section.id": None,
         "specification.id": None,
     }
     scraped_data["specs"].append(scraped_spec)
     view = ScrapedViewFeature(self.page, scraped_data)
     out = view.generate_data()
     spec_content, mat_content = view.new_specification(scraped_spec)
     section_content = view.new_section(scraped_spec, spec_content["id"])
     expected = self.empty_view(scraped_data)
     expected["features"]["links"]["sections"] = [section_content["id"]]
     expected["linked"]["maturities"] = [mat_content]
     expected["linked"]["specifications"] = [spec_content]
     expected["linked"]["sections"] = [section_content]
     self.assertDataEqual(expected, out)