Invalid scope #19

Closed
baverman opened this Issue Mar 7, 2012 · 0 comments

Comments

Projects
None yet
1 participant
Owner

baverman commented Mar 7, 2012

# -*- coding: utf-8 -*-
from unittest import skipIf
from django.test import TestCase
from django.conf import settings

from suds.client import Client

from logibox.testutils import TestFactory, DjangoSudsTransport
from api.models import ApiAuth
from account.utils import do_hash_password

settings.DEBUG = True
only_for_api_settings = skipIf('api' not in settings.SETTINGS_MODULE, 'Only for settings_api') 

@only_for_api_settings
class EmsServiceTestCase(TestCase):
    def setUp(self):
        self.factory = TestFactory()
        self.sender = self.factory.create_sender()
        ApiAuth(sender=self.sender, ip='127.0.0.1', password=do_hash_password('test'),
            allowed_services='ems').save()

    def get_soap_client(self, username, password):
        client = Client('http://testserver/api/soap/ems/?wsdl',
            transport=DjangoSudsTransport(self.client), cache=None)

        request_header = client.factory.create('AuthHeader')
        request_header.username = self.sender.number
        request_header.password = 'test'
        client.set_options(soapheaders=request_header)


    def test_station_list(self):
        client = self.get_|||||||||
        p1 = self.factory.p0001
        p2 = self.factory.p0002

        stations = client.service.getStations().Station
        assert len(stations) == 2

        station = stations[0]
        assert station.number == '0001'
        assert station.title == 'Почтомат 1'
        assert station.address == 'Город 1, Улица первого почтомата 1 стр. 2'
        assert station.districtTitle == 'Район 1'
        assert station.districtCode == '1'
        assert station.districtIntCode == None
        assert station.workingHours == 'rtc'
        assert station.gps

baverman closed this in 54845f8 Mar 11, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment