'When realm.create_stream_by_admins_only setting is active and
the number of days since the user had joined is less than waiting period
threshold, non admin users shouldn\'t be able to create new streams.'

def test_create_stream_by_admins_only_setting(self):

    user_profile = self.example_user('hamlet')
    email = user_profile.email
    self.login(email)
    do_set_realm_property(user_profile.realm, 'create_stream_by_admins_only', True)
    stream_name = ['adminsonlysetting']
    result = self.common_subscribe_to_streams(email, stream_name)
    self.assert_json_error(result, 'User    cannot    create    streams.')
