def test_with_and_without_uuid(self): c_with_uuid = fake_profile.FakeProfileConfig().uuid() c_without_uuid = fake_profile.FakeProfileConfig() a = fake_profile.FakeUser(seed=23, config=c_with_uuid) assert a.uuid.value is not None b = fake_profile.FakeUser(seed=23, config=c_without_uuid) assert b.uuid.value is None
def test_null_create_profile(self): empty_profile = profile.User() create_profile = fake_profile.FakeUser( seed=1337, config=fake_profile.FakeProfileConfig().default().create()) update_profile = fake_profile.FakeUser( seed=1337, config=fake_profile.FakeProfileConfig().default()) with pytest.raises(exceptions.PublisherVerificationFailure): update_profile.verify_all_publishers(empty_profile) assert create_profile.verify_all_publishers(empty_profile) is True assert update_profile.verify_all_publishers(create_profile) is True
def test_null_create_profile(self): empty_profile = profile.User() create_profile = fake_profile.FakeUser( seed=1337, config=fake_profile.FakeProfileConfig().default().minimal().create( ).no_display()) update_profile = fake_profile.FakeUser( seed=1337, config=fake_profile.FakeProfileConfig().minimal().default( ).no_display()) update_profile.uuid = create_profile.uuid update_profile.user_id = create_profile.user_id update_profile.primary_username.value = "test" # invalid because default publisher is cis update_profile.primary_username.signature.publisher.name = "mozilliansorg" with pytest.raises(exceptions.PublisherVerificationFailure): update_profile.verify_all_publishers(empty_profile) assert create_profile.verify_all_publishers(empty_profile) is True assert update_profile.verify_all_publishers(create_profile) is True
def setup(self): os.environ[ "CIS_DISCOVERY_URL"] = "https://auth.allizom.org/.well-known/mozilla-iam" self.helper_configuration = helpers.Configuration() self.null_user = profile.User() u = fake_profile.FakeUser( config=fake_profile.FakeProfileConfig().default().create()) u.uuid = self.null_user.uuid u.primary_username = self.null_user.primary_username u = self.helper_configuration.ensure_appropriate_publishers_and_sign( fake_profile=u, condition="create") u.verify_all_publishers(profile.User(user_structure_json=None)) self.durable_profile = u.as_json()