Esempio n. 1
0
 def test_happy_builder_with_pii(self):
     builder = ScraperUtils.BenchmarkRecordBuilder(id="foo",
                                                   state="bar",
                                                   county="baz",
                                                   party_id="lol")
     builder.first_name = Pii.String("pii")
     r = builder.build()
     assert r.first_name == "pii"
     assert r.id == "foo"
     assert r.state == "bar"
     assert r.county == "baz"
     assert r.party_id == "lol"
Esempio n. 2
0
    def test_enforce_use_of_pii_wrappers(self):
        with pytest.raises(TypeError, match=".*Pii.String.*"):
            builder = ScraperUtils.BenchmarkRecordBuilder(id="foo",
                                                          state="bar",
                                                          county="baz")
            builder.first_name = "I should be in a PII wrapper"
            builder.build()

        with pytest.raises(TypeError, match=".*Pii.String.*"):
            ScraperUtils.BenchmarkRecord(id="foo",
                                         state="bar",
                                         county="baz",
                                         first_name="naked PII")