def setUp(self): self.oa2_backend = DjangoBackend() self.user = AstakosUser.objects.create(username="******") self.token = self.oa2_backend.token_model.create( code='12345', expires_at=datetime.now() + timedelta(seconds=5), user=self.user, client=self.oa2_backend.client_model.create(type='public'), redirect_uri='https://server.com/handle_code', scope='user-scope')
def setUp(self): backend = activation_backends.get_backend() self.user1 = get_local_user('*****@*****.**', email_verified=True, moderated=True, is_rejected=False) backend.activate_user(self.user1) assert self.user1.is_active is True self.user2 = get_local_user('*****@*****.**', email_verified=True, moderated=True, is_rejected=False) backend.activate_user(self.user2) assert self.user2.is_active is True c1 = Component(name='component1', url='http://localhost/component1') c1.save() s1 = Service(component=c1, type='type1', name='service1') s1.save() e1 = Endpoint(service=s1) e1.save() e1.data.create(key='versionId', value='v1.0') e1.data.create(key='publicURL', value='http://localhost:8000/s1/v1.0') s2 = Service(component=c1, type='type2', name='service2') s2.save() e2 = Endpoint(service=s2) e2.save() e2.data.create(key='versionId', value='v1.0') e2.data.create(key='publicURL', value='http://localhost:8000/s2/v1.0') c2 = Component(name='component2', url='http://localhost/component2') c2.save() s3 = Service(component=c2, type='type3', name='service3') s3.save() e3 = Endpoint(service=s3) e3.save() e3.data.create(key='versionId', value='v2.0') e3.data.create(key='publicURL', value='http://localhost:8000/s3/v2.0') oa2_backend = DjangoBackend() self.token = oa2_backend.token_model.create( code='12345', expires_at=datetime.now() + timedelta(seconds=5), user=self.user1, client=oa2_backend.client_model.create(type='public'), redirect_uri='https://server.com/handle_code')
# Copyright (C) 2010-2014 GRNET S.A. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. from astakos.oa2.backends import DjangoBackend from astakos.oa2 import settings oa2_backend = DjangoBackend(endpoints_prefix=settings.ENDPOINT_PREFIX, token_endpoint=settings.TOKEN_ENDPOINT, token_length=settings.TOKEN_LENGTH, token_expires=settings.TOKEN_EXPIRES, authorization_endpoint= settings.AUTHORIZATION_ENDPOINT, authorization_code_length= settings.AUTHORIZATION_CODE_LENGTH, redirect_uri_limit= settings.MAXIMUM_ALLOWED_REDIRECT_URI_LENGTH) urlpatterns = oa2_backend.get_url_patterns()
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF # USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # # The views and conclusions contained in the software and # documentation are those of the authors and should not be # interpreted as representing official policies, either expressed # or implied, of GRNET S.A. from astakos.oa2.backends import DjangoBackend from astakos.oa2 import settings oa2_backend = DjangoBackend(endpoints_prefix=settings.ENDPOINT_PREFIX, token_endpoint=settings.TOKEN_ENDPOINT, token_length=settings.TOKEN_LENGTH, token_expires=settings.TOKEN_EXPIRES, authorization_endpoint= settings.AUTHORIZATION_ENDPOINT, authorization_code_length= settings.AUTHORIZATION_CODE_LENGTH, redirect_uri_limit= settings.MAXIMUM_ALLOWED_REDIRECT_URI_LENGTH) urlpatterns = oa2_backend.get_url_patterns()