Exemplo n.º 1
0
def test_fetch_warning():

    user = User.objects.create_user('a', '*****@*****.**', 'bob')
    user.first_name = "testf"
    user.last_name = "testf"
    user.save()
    email = EmailAddress(address='*****@*****.**', user=user)
    email.save()

    ease_blog = Blog(from_feed = False)
    ease_blog.save()
    ease_repo = Repository(web_url = "http://git.gnome.org/browse/ease",
        clone_url = "git://git.gnome.org/ease",
        from_feed = False)
    ease_repo.save()
    ease = Project(title = "Ease",
        description = "A presentation application for the Gnome Desktop.",
        website = "http://www.ease-project.org",
        wiki = "http://live.gnome.org/Ease",
        blog_id = ease_blog.id,
        repository_id = ease_repo.id)
    ease.save()
    ease.authors.add(user)
    ease.save()

    ease.do_warnings()
    assert ease.blog_warn_level > 0
    assert ease.repo_warn_level > 0
Exemplo n.º 2
0
def create_user(request, form):
  data = form.cleaned_data
  
  # use an md5 of the email as a username
  m = md5()
  m.update(data["email"])

  # if it's ok, register the user
  user = User.objects.create_user(m.hexdigest()[0:30],
                                  data['email'],
                                  data['password'])

  # set the user's first/last names
  user.first_name = data['first_name']
  user.last_name = data['last_name']

  # save the user
  user.save()

  #Add additional info
  info = UserInfo(user=user, mentor=False)
  info.save()

  #Add email information
  m = EmailAddress(address=data['email'], user=user)
  m.save()

  # search past events for the user's email
  for event in Event.objects.filter(author_email__iexact = user.email,
                                    author = None):
    event.author = user
    event.save()

  # search past events for the user's first and last name
  name = user.get_full_name()
  for event in Event.objects.filter(author_name__iexact = name, author = None):
    event.author = user
    event.save()

  # search contributors for the user's name and email
  for contrib in Contributor.objects.filter(email__iexact = user.email,
                                            user = None):
    contrib.user = user
    contrib.save()

  for contrib in Contributor.objects.filter(name__iexact = name, user = None):
    contrib.user = user
    contrib.save()
  
  # log the user in (since we can't send emails for validation AFAIK)
  user = auth.authenticate(username = user.username,
                           password = data['password'])
  auth.login(request, user)
  
  return HttpResponseRedirect(request.POST['next'])
Exemplo n.º 3
0
def test_email_exclude(client):

        m = EmailAddress(address="*****@*****.**")
        m.save()

        #Load Site
        response = client.get('/email/remove/[email protected]')

        #Check for normal processing
        assert response.status_code in [200, 301]

        assert EmailAddress.objects.filter(address="*****@*****.**").get().excluded
Exemplo n.º 4
0
def test_email_exclude(client):

    m = EmailAddress(address="*****@*****.**")
    m.save()

    #Load Site
    response = client.get('/email/remove/[email protected]')

    #Check for normal processing
    assert response.status_code in [200, 301]

    assert EmailAddress.objects.filter(
        address="*****@*****.**").get().excluded
Exemplo n.º 5
0
def send_mail(subject, body, from_email, recipient_list, fail_silently=False):
    to = [addr for addr in recipient_list if not EmailAddress.is_excluded(addr)]

    #Doing a separate email for each person so we can allow unsubscription links
    for addr in to:

        print "Emailing: %s" % addr
        print "Subject: %s" % subject

        #For now use default email body with an unsubscribe link
        html_content = '%s <br><a href="%s"> Unsubscribe From RCOS Emails</a>' % (body, SITE_ADDRESS + reverse('emaillist.views.remove_email', args=[addr]))

        msg = EmailMessage(subject, html_content, from_email, [addr])
        msg.content_subtype = "html"  # Main content is now text/html
        msg.send(fail_silently = fail_silently)
Exemplo n.º 6
0
               ('*****@*****.**', 'password', 'Matt', 'Arsenault'),
               ('*****@*****.**', 'password', 'Joseph', 'Dougherty'),
			   ('*****@*****.**', 'password','Ben', 'Shippee'),
			   ('*****@*****.**', 'password','Colin', 'Rice'),
               ]:
  m = md5()
  m.update(person[0])
  user = User.objects.create_user(m.hexdigest()[0:30], person[0], person[1])
  user.first_name = person[2]
  user.last_name = person[3]
  user.is_staff = True
  user.info = UserInfo(user=user,mentor=True)
  user.info.save()
  user.is_superuser = True
  user.save()
  email = EmailAddress(address=person[0], user=user)
  email.save()
  print "Added {0}".format(user.get_full_name())
  
# make some projects
ease_blog = Blog(from_feed = False)
ease_blog.save()
ease_repo = Repository(web_url = "http://git.gnome.org/browse/ease",
                       clone_url = "git://git.gnome.org/ease",
                       from_feed = False)
ease_repo.save()
ease = Project(title = "Ease",
               description = "A presentation application for the Gnome Desktop.",
               website = "http://www.ease-project.org",
               wiki = "http://live.gnome.org/Ease",
               blog_id = ease_blog.id,