'Non admin users with account age greater or equal to waiting period
threshold should be able to create new streams.'

def test_create_stream_by_waiting_period_threshold(self):

    user_profile = self.example_user('hamlet')
    user_profile.date_joined = timezone_now()
    user_profile.save()
    email = user_profile.email
    self.login(email)
    do_change_is_admin(user_profile, False)
    do_set_realm_property(user_profile.realm, 'waiting_period_threshold', 10)
    stream_name = ['waitingperiodtest']
    result = self.common_subscribe_to_streams(email, stream_name)
    self.assert_json_error(result, 'User    cannot    create    streams.')
    do_set_realm_property(user_profile.realm, 'waiting_period_threshold', 0)
    result = self.common_subscribe_to_streams(email, stream_name)
    self.assert_json_success(result)
