コード例 #1
0
 def test_load_specification_row_existing_resources(self):
     reference = self.get_instance(
         'Reference', ('web-css-background-size', 'background-size'))
     section = reference.section
     spec = section.specification
     scraped_spec = {
         'section.note': 'new note',
         'section.subpath': section.subpath['en'],
         'section.name': section.name['en'],
         'specification.mdn_key': spec.mdn_key,
         'section.id': section.id,
         'specification.id': spec.id}
     scraped_data = self.empty_scrape()
     scraped_data['specs'].append(scraped_spec)
     view = ScrapedViewFeature(self.page, scraped_data)
     out = view.generate_data()
     expected = self.empty_view(scraped_data)
     spec_content, mat_content = view.load_specification(spec.id)
     section_content = view.load_section(section.id)
     reference_content = view.load_or_new_reference(section.id)
     reference_content['note'] = {'en': 'new note'}
     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_existing_resources(self):
     reference = self.get_instance(
         'Reference', ('web-css-background-size', 'background-size'))
     section = reference.section
     spec = section.specification
     scraped_spec = {
         'section.note': 'new note',
         'section.subpath': section.subpath['en'],
         'section.name': section.name['en'],
         'specification.mdn_key': spec.mdn_key,
         'section.id': section.id,
         'specification.id': spec.id
     }
     scraped_data = self.empty_scrape()
     scraped_data['specs'].append(scraped_spec)
     view = ScrapedViewFeature(self.page, scraped_data)
     out = view.generate_data()
     expected = self.empty_view(scraped_data)
     spec_content, mat_content = view.load_specification(spec.id)
     section_content = view.load_section(section.id)
     reference_content = view.load_or_new_reference(section.id)
     reference_content['note'] = {'en': 'new note'}
     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
 def test_load_specification(self):
     spec = self.get_instance('Specification', 'css3_backgrounds')
     maturity = spec.maturity
     view = ScrapedViewFeature(self.page, self.empty_scrape())
     spec_content, mat_content = view.load_specification(spec.id)
     expected_spec = {
         'id': str(spec.id), 'slug': spec.slug, 'mdn_key': spec.mdn_key,
         'uri': spec.uri, 'name': spec.name,
         'links': {'maturity': str(maturity.id)}}
     self.assertDataEqual(expected_spec, spec_content)
     expected_mat = {
         'id': str(maturity.id), 'slug': maturity.slug,
         'name': maturity.name}
     self.assertDataEqual(expected_mat, mat_content)
コード例 #4
0
ファイル: test_scrape.py プロジェクト: renoirb/browsercompat
 def test_load_specification(self):
     spec = self.get_instance("Specification", "css3_backgrounds")
     maturity = spec.maturity
     view = ScrapedViewFeature(self.page, self.empty_scrape())
     spec_content, mat_content = view.load_specification(spec.id)
     expected_spec = {
         "id": str(spec.id),
         "slug": spec.slug,
         "mdn_key": spec.mdn_key,
         "uri": spec.uri,
         "name": spec.name,
         "links": {"maturity": str(maturity.id), "sections": []},
     }
     self.assertDataEqual(expected_spec, spec_content)
     expected_mat = {"id": str(maturity.id), "slug": maturity.slug, "name": maturity.name}
     self.assertDataEqual(expected_mat, mat_content)
コード例 #5
0
ファイル: test_scrape.py プロジェクト: yyinhai/browsercompat
 def test_load_specification(self):
     spec = self.get_instance('Specification', 'css3_backgrounds')
     maturity = spec.maturity
     view = ScrapedViewFeature(self.page, self.empty_scrape())
     spec_content, mat_content = view.load_specification(spec.id)
     expected_spec = {
         'id': str(spec.id),
         'slug': spec.slug,
         'mdn_key': spec.mdn_key,
         'uri': spec.uri,
         'name': spec.name,
         'links': {
             'maturity': str(maturity.id)
         }
     }
     self.assertDataEqual(expected_spec, spec_content)
     expected_mat = {
         'id': str(maturity.id),
         'slug': maturity.slug,
         'name': maturity.name
     }
     self.assertDataEqual(expected_mat, mat_content)
コード例 #6
0
ファイル: test_scrape.py プロジェクト: renoirb/browsercompat
 def test_load_specification_row_existing_resources(self):
     section = self.get_instance("Section", "background-size")
     spec = section.specification
     scraped_spec = {
         "section.note": "new note",
         "section.subpath": section.subpath["en"],
         "section.name": section.name["en"],
         "specification.mdn_key": spec.mdn_key,
         "section.id": section.id,
         "specification.id": spec.id,
     }
     scraped_data = self.empty_scrape()
     scraped_data["specs"].append(scraped_spec)
     view = ScrapedViewFeature(self.page, scraped_data)
     out = view.generate_data()
     expected = self.empty_view(scraped_data)
     spec_content, mat_content = view.load_specification(spec.id)
     section_content = view.load_section(section.id)
     section_content["note"] = {"en": "new note"}
     expected["features"]["links"]["sections"] = [str(section.id)]
     expected["linked"]["maturities"] = [mat_content]
     expected["linked"]["specifications"] = [spec_content]
     expected["linked"]["sections"] = [section_content]
     self.assertDataEqual(expected, out)