-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #851 from Natay/master
user merging added #847
- Loading branch information
Showing
13 changed files
with
203 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{% extends "forum_base.html" %} | ||
{% load forum_tags %} | ||
{% load socialaccount %} | ||
{% block headtitle %}Login{% endblock %} | ||
|
||
{% block content %} | ||
<form class="ui form" method="post" action="{% url 'merge_profile' %}"> | ||
|
||
<div class="ui segment inputcolor socialbox"> | ||
|
||
<div class="ui center aligned header"> | ||
Merge Profiles | ||
</div> | ||
|
||
{% csrf_token %} | ||
|
||
{{ form.errors }} | ||
|
||
<div class="fields"> | ||
|
||
<div class="field"> | ||
|
||
<label><i class="trash can icon"></i> Delete Profile</label> | ||
{{ form.alias }} | ||
<div class="muted"> | ||
Email to delete | ||
</div> | ||
|
||
</div> | ||
<div class="field" style="margin: auto"> | ||
<i class="angle double right icon"></i> | ||
</div> | ||
|
||
<div class="field"> | ||
|
||
<label><i class="user icon"></i> Main Profile</label> | ||
{{ form.main }} | ||
<div class="muted"> | ||
Email to merge into | ||
</div> | ||
|
||
</div> | ||
|
||
|
||
</div> | ||
|
||
<div class="field"> | ||
<button class="ui primary button" type="submit"> | ||
<i class="user plus icon"></i>Merge | ||
</button> | ||
|
||
<a class="ui right floated button" href="#" onclick="window.history.back()"> | ||
<i class="chevron left icon"></i>Back | ||
</a> | ||
</div> | ||
|
||
</div> | ||
|
||
|
||
</form> | ||
|
||
|
||
|
||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,8 @@ def setUp(self): | |
logger.setLevel(logging.WARNING) | ||
self.owner = User.objects.create(username=f"tested{get_uuid(10)}", email="[email protected]", | ||
password="tested", is_superuser=True, is_staff=True) | ||
|
||
self.user2 = User.objects.create(username=f"test{get_uuid(10)}", email="[email protected]", | ||
password="test", is_superuser=True, is_staff=True) | ||
# Create an existing tested post | ||
self.post = models.Post.objects.create(title="Test", author=self.owner, content="Test", type=models.Post.QUESTION, uid='foo') | ||
self.uid = 'foo' | ||
|
@@ -78,6 +79,18 @@ def test_comment_moderation(self): | |
|
||
self.moderate(choices=choices, post=comment, extra={'pid': self.post.uid}) | ||
|
||
def test_merge_profile(self): | ||
"Test merging two profiles" | ||
|
||
# Create fake request | ||
data = {'main': self.owner.email, 'alias': self.user2.email} | ||
|
||
request = fake_request(url=reverse('merge_profile'), data=data, user=self.owner) | ||
response = views.merge_profile(request=request) | ||
|
||
self.process_response(response) | ||
|
||
pass | ||
|
||
def process_response(self, response): | ||
"Check the response on POST request is redirected" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ class ForumNavigation(TestCase): | |
def setUp(self): | ||
logger.setLevel(logging.WARNING) | ||
|
||
self.owner = User.objects.create(username=f"tested{get_uuid(10)}", email="[email protected]") | ||
self.owner = User.objects.create(username=f"tested{get_uuid(10)}", email="[email protected]", is_staff=True) | ||
self.owner.set_password("tested") | ||
self.badge = Badge.objects.first() | ||
# Create a tested post | ||
|
@@ -60,7 +60,7 @@ def test_public_pages(self): | |
reverse("myvotes"), | ||
reverse('api_traffic'), | ||
reverse('latest_feed'), | ||
reverse('latest_feed'), | ||
reverse('merge_profile'), | ||
reverse('post_tags', kwargs=dict(tag='tag1')), | ||
reverse('tag_feed', kwargs=dict(text='tag1')), | ||
reverse('post_feed', kwargs=dict(text=self.post.uid)), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
# Do not multi-thread tests. | ||
|
||
TASK_RUNNER = "disable" | ||
TASK_RUNNER = "block" | ||
|
||
INIT_PLANET = False | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters