Skip to content
This repository has been archived by the owner on Oct 5, 2021. It is now read-only.

Commit

Permalink
upd doc #226 / upd requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
FoxMaSk committed Oct 25, 2017
1 parent aff7dbf commit c508176
Show file tree
Hide file tree
Showing 29 changed files with 309 additions and 304 deletions.
4 changes: 2 additions & 2 deletions django_th/tests/test_main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# coding: utf-8
from django.test import TestCase
from django.contrib.auth.models import User
from django_th.models import TriggerService, UserService, ServicesActivated
from django.contrib.auth.models import User
from django.test import TestCase
from th_wallabag.models import Wallabag


Expand Down
91 changes: 66 additions & 25 deletions django_th/tests/test_views_userservices.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# coding: utf-8
from django.core.urlresolvers import reverse
from django.test import RequestFactory

from django_th.views_userservices import UserServiceListView
from django_th.models import UserService
from django_th.tests.test_views import setup_view
from django_th.tests.test_main import MainTest
from django_th.views_userservices import UserServiceListView


class UserServiceListViewTestCase(MainTest):
Expand All @@ -18,37 +19,77 @@ def test_context_data(self):
# Setup request and view
queryset = UserService.objects.all()

request = self.factory.get('/')
request = self.factory.get(reverse('user_services'))
request.user = self.user

response = UserServiceListView.as_view()(request)
self.assertEqual(response.status_code, 200)

view = UserServiceListView(
template_name='services/services.html',
context_object_name="services_list",
object_list=queryset)
view = setup_view(view, request)

context = view.get_context_data()
self.assertIn('service_list_remaining', context)


"""
class UserServiceCreateViewTestCase(MainTest):
def setUp(self):
super(UserServiceCreateViewTestCase, self).setUp()
# Every test needs access to the request factory.
self.factory = RequestFactory()
def test_context_data(self):
# Setup request and view
request = self.factory.get(reverse('add_service', args=['ServiceRss']))
request.user = self.user
view = UserServiceCreateView(
template_name='services/service_form.html',
form_class=UserServiceForm)
kwargs = dict()
kwargs['service_name'] = 'ServiceRss'
view = setup_view(view, request, **kwargs)
context = view.get_context_data()
self.assertIn('service_name_alone', context)
self.assertIn('service_name', context)
self.assertIn('SERVICES_AUTH', context)
self.assertIn('SERVICES_HOSTED_WITH_AUTH', context)
self.assertIn('SERVICES_NEUTRAL', context)
class UserServiceUpdateViewTestCase(MainTest):
def setUp(self):
super(UserServiceUpdateViewTestCase, self).setUp()
# Every test needs access to the request factory.
self.factory = RequestFactory()
def test_context_data(self):
# Setup request and view
request = self.factory.get(reverse('edit_service', args=[1]))
request.user = self.user
view = UserServiceUpdateView(
template_name='services/service_form.html',
form_class=UserServiceForm)
kwargs = dict()
kwargs['pk'] = 1
view = setup_view(view, request, **kwargs)
context = view.get_context_data()
if request.user.is_authenticated():
nb_user_service = nb_service = 20
context, action = self.get_action_context(context,
nb_user_service,
nb_service)
self.assertEqual(context['action'], action)

nb_user_service = 19
nb_service = 20
context, action = self.get_action_context(context,
nb_user_service,
nb_service)
self.assertEqual(context['action'], action)

def get_action_context(self, context, nb_user_service, nb_service):
if nb_user_service == nb_service:
context['action'] = 'hide'
action = 'hide'
else:
context['action'] = 'display'
action = 'display'

return context, action
self.assertIn('service_name_alone', context)
self.assertIn('service_name', context)
self.assertIn('SERVICES_AUTH', context)
self.assertIn('SERVICES_HOSTED_WITH_AUTH', context)
self.assertIn('SERVICES_NEUTRAL', context)
"""
4 changes: 2 additions & 2 deletions django_th/th_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
APPS_DIR = ROOT_DIR.path('django_th')
env = environ.Env()
env_file = str(ROOT_DIR.path('.env'))
print('Loading : {}'.format(env_file))
# print('Loading : {}'.format(env_file))
env.read_env(env_file)
print('The .env file has been loaded. See settings.py for more information')
# print('The .env file has been loaded. See settings.py for more information')

DJANGO_TH = {
# paginating
Expand Down
3 changes: 0 additions & 3 deletions django_th/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@
# * service
# ****************************************
url(r'^th/service/$', UserServiceListView.as_view(), name='user_services'),
url(r'^th/service/(?P<action>\w+)$',
UserServiceListView.as_view(),
name='user_services'),
url(r'^th/service/add/(?P<service_name>\w+)$',
UserServiceCreateView.as_view(),
name='add_service'),
Expand Down
3 changes: 3 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ The Installation Guide
----------------------

.. toctree::
:maxdepth: 2

installation_guide/quickstart
installation_guide/installation
Expand All @@ -91,12 +92,14 @@ The User Guide
--------------

.. toctree::
:maxdepth: 2

user_guide/index

The Administration Guide
------------------------

.. toctree::
:maxdepth: 2

admin_guide/index
24 changes: 12 additions & 12 deletions docs/installation_guide/evernote.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,16 @@ User Guide
Activation of the service
~~~~~~~~~~~~~~~~~~~~~~~~~

From the page http://127.0.0.1:8000/th/service/add/
From the page http://127.0.0.1:8000/th/service/

.. image:: https://raw.githubusercontent.com/foxmask/django-th/master/docs/installation_guide/public_service_wallabag_add.png
:alt: My Activated Services
.. image:: https://raw.githubusercontent.com/foxmask/django-th/master/docs/installation_guide/public_services.png
:alt: Services

then in the form, select Evernote in the dropdown box and press "Activate it"
from the "Services available" part of the page, select Evernote and press "Activate it"

Defining a trigger
~~~~~~~~~~~~~~~~~~

with Evernote as consumer, when another service is used as a provider

.. image:: https://raw.githubusercontent.com/foxmask/django-th/master/docs/installation_guide/evernote_consumer_step3.png
:alt: evernote step 3

.. image:: https://raw.githubusercontent.com/foxmask/django-th/master/docs/installation_guide/evernote_consumer_step4.png
:alt: evernote step 4

with Evernote as provider, when another service is used as a consumer

.. image:: https://raw.githubusercontent.com/foxmask/django-th/master/docs/installation_guide/evernote_provider_step1.png
Expand All @@ -38,6 +30,14 @@ with Evernote as provider, when another service is used as a consumer
.. image:: https://raw.githubusercontent.com/foxmask/django-th/master/docs/installation_guide/evernote_provider_step2.png
:alt: evernote step 2

with Evernote as consumer, when another service is used as a provider

.. image:: https://raw.githubusercontent.com/foxmask/django-th/master/docs/installation_guide/evernote_consumer_step3.png
:alt: evernote step 3

.. image:: https://raw.githubusercontent.com/foxmask/django-th/master/docs/installation_guide/evernote_consumer_step4.png
:alt: evernote step 4

Installation Guide
------------------

Expand Down
24 changes: 12 additions & 12 deletions docs/installation_guide/github.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,16 @@ User Guide
Activation of the service
~~~~~~~~~~~~~~~~~~~~~~~~~

From the page http://127.0.0.1:8000/th/service/add/
From the page http://127.0.0.1:8000/th/service/

.. image:: https://raw.githubusercontent.com/foxmask/django-th/master/docs/installation_guide/public_service_wallabag_add.png
:alt: My Activated Services
.. image:: https://raw.githubusercontent.com/foxmask/django-th/master/docs/installation_guide/public_services.png
:alt: Services

then in the form, select Github in the dropdown box, then username and password, and press "Activate it"
from the "Services available" part of the page, select Github and press "Activate it"

Defining a trigger
~~~~~~~~~~~~~~~~~~

with Github as consumer, when another service is used as a provider

.. image:: https://raw.githubusercontent.com/foxmask/django-th/master/docs/installation_guide/github_consumer_step3.png
:alt: github step 3

.. image:: https://raw.githubusercontent.com/foxmask/django-th/master/docs/installation_guide/github_consumer_step4.png
:alt: github step 4

with Github as provider, when another service is used as a consumer

.. image:: https://raw.githubusercontent.com/foxmask/django-th/master/docs/installation_guide/github_provider_step1.png
Expand All @@ -38,6 +30,14 @@ with Github as provider, when another service is used as a consumer
.. image:: https://raw.githubusercontent.com/foxmask/django-th/master/docs/installation_guide/github_provider_step2.png
:alt: github step 2

with Github as consumer, when another service is used as a provider

.. image:: https://raw.githubusercontent.com/foxmask/django-th/master/docs/installation_guide/github_consumer_step3.png
:alt: github step 3

.. image:: https://raw.githubusercontent.com/foxmask/django-th/master/docs/installation_guide/github_consumer_step4.png
:alt: github step 4

Installation Guide
------------------

Expand Down
2 changes: 1 addition & 1 deletion docs/installation_guide/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Requirements
Commons requirements
--------------------

* Python 3.5.x or 3.6.x
* `Python 3.6.x <https://python.org>`_
* `Redis <https://redis.io/>`_
* `DjangoRestFramework <https://pypi.python.org/pypi/Django/>`_
* `Django <https://pypi.python.org/pypi/Django/>`_
Expand Down
11 changes: 6 additions & 5 deletions docs/installation_guide/instapush.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ User Guide
Activation of the service
~~~~~~~~~~~~~~~~~~~~~~~~~

From the page http://127.0.0.1:8000/th/service/add/
From the page http://127.0.0.1:8000/th/service/

.. image:: https://raw.githubusercontent.com/foxmask/django-th/master/docs/installation_guide/public_service_wallabag_add.png
:alt: My Activated Services
.. image:: https://raw.githubusercontent.com/foxmask/django-th/master/docs/installation_guide/public_services.png
:alt: Services

then in the form, select Instapush in the dropdown box then in the form, just fill the user token, then press "Activate it"
from the "Services available" part of the page, select Instapush then fill the user token, then press "Activate it"

instapush is not used as provider as it's just send notification from others data

with Instapush as consumer, when another service is used as a provider

Expand All @@ -27,7 +29,6 @@ with Instapush as consumer, when another service is used as a provider
.. image:: https://raw.githubusercontent.com/foxmask/django-th/master/docs/installation_guide/instapush_consumer_step4.png
:alt: instapush step 4

instapush is not used as provider as it's just send notification from others data

Installation Guide
------------------
Expand Down
24 changes: 12 additions & 12 deletions docs/installation_guide/mastodon.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ User Guide
Activation of the service
~~~~~~~~~~~~~~~~~~~~~~~~~

From the page http://127.0.0.1:8000/th/service/add/
From the page http://127.0.0.1:8000/th/service/

.. image:: https://raw.githubusercontent.com/foxmask/django-th/master/docs/installation_guide/public_service_wallabag_add.png
:alt: My Activated Services
.. image:: https://raw.githubusercontent.com/foxmask/django-th/master/docs/installation_guide/public_services.png
:alt: Services

then in the form, select Mastodon in the dropdown box, and fill all the fields with the information you can have from mastodon :
from the "Services available" part of the page, select Mastodon then fill all the fields with the information you can have from mastodon:

* in Nickname ; put your mastodon nickname
* in Password ; put your mastodon password
Expand All @@ -31,14 +31,6 @@ Then press "Activate it"
Defining a trigger
~~~~~~~~~~~~~~~~~~

with Mastodon as consumer, when another service is used as a provider

.. image:: https://raw.githubusercontent.com/foxmask/django-th/master/docs/installation_guide/mastodon_consumer_step3.png
:alt: mastodon step 3

.. image:: https://raw.githubusercontent.com/foxmask/django-th/master/docs/installation_guide/mastodon_consumer_step4.png
:alt: mastodon step 4

with Mastodon as provider, when another service is used as a consumer

.. image:: https://raw.githubusercontent.com/foxmask/django-th/master/docs/installation_guide/mastodon_provider_step1.png
Expand All @@ -47,6 +39,14 @@ with Mastodon as provider, when another service is used as a consumer
.. image:: https://raw.githubusercontent.com/foxmask/django-th/master/docs/installation_guide/mastodon_provider_step2.png
:alt: mastodon step 2

with Mastodon as consumer, when another service is used as a provider

.. image:: https://raw.githubusercontent.com/foxmask/django-th/master/docs/installation_guide/mastodon_consumer_step3.png
:alt: mastodon step 3

.. image:: https://raw.githubusercontent.com/foxmask/django-th/master/docs/installation_guide/mastodon_consumer_step4.png
:alt: mastodon step 4

if you tick the "fav" checkbox, this will allow you to "save" the toot to another service, for example to Wallabag, to be read later.

Installation Guide
Expand Down
21 changes: 19 additions & 2 deletions docs/installation_guide/pelican.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,25 @@ Service Description:

Pelican Static Site Generator

User Guide
----------

Activation of the service
~~~~~~~~~~~~~~~~~~~~~~~~~

From the page http://127.0.0.1:8000/th/service/

.. image:: https://raw.githubusercontent.com/foxmask/django-th/master/docs/installation_guide/public_services.png
:alt: Services

from the "Services available" part of the page, select Pelican and press "Activate it"


Installation Guide
------------------

The .env file
-------------
~~~~~~~~~~~~~

Set an author that will be added to the creation of each post

Expand All @@ -17,7 +34,7 @@ Set an author that will be added to the creation of each post
Configuration from the Admin panel
----------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

http://127.0.0.1:8000/admin/django_th/servicesactivated/

Expand Down

0 comments on commit c508176

Please sign in to comment.