Beispiel #1
0
 def setUp(self):
     self.entity = Entity(name='München').save()
     self.entity2 = Entity(name='Hamburg').save()
     Muncipality(name='Berlin').save()
     self.muncipality = Muncipality.objects.get(name='Berlin')
     District(name="Charlottenburg", muncipality=self.muncipality).save()
     District(name="Schöneberg", muncipality=self.muncipality).save()
     self.factory = RequestFactory()
     self.entities = Entity.objects.all().values()
Beispiel #2
0
class CoreViewTestCase(TestCase):
    def setUp(self):
        Muncipality(name='Berlin').save()

        self.d1 = District(name='Mitte',
                           muncipality=Muncipality.objects.get(name='Berlin'))
        self.d1.save()

        self.d2 = District(name='Charlottenburg',
                           muncipality=Muncipality.objects.get(name='Berlin'))
        self.d2.save()
        self.user = User.objects.create_user(username='******',
                                             email='*****@*****.**',
                                             password='******')

        self.factory = RequestFactory()

    def test_view_feeds(self):
        url = reverse('wbc.core.views.feeds')
        resp = Client().get(url)
        self.assertEqual(resp.status_code, 200)

    def test_view_login_success(self):
        url = reverse('wbc.core.views.login_user')
        resp = Client().post(url, {
            'username': self.user.username,
            'password': '******'
        })
        self.assertEqual(resp.status_code, 302)

    def test_view_login_success_next(self):
        url = reverse('wbc.core.views.login_user')
        resp = Client().post(
            url, {
                'username': self.user.username,
                'password': '******',
                'next': '/liste'
            })
        self.assertEqual(resp.status_code, 302)

    def test_view_login_fail(self):
        url = reverse('wbc.core.views.login_user')
        resp = Client().post(url, {
            'username': self.user.username,
            'password': ''
        })
        self.assertEqual(resp.status_code, 200)

    def test_view_logout(self):
        url = reverse('wbc.core.views.logout_user')
        resp = Client().get(url)
        self.assertEqual(resp.status_code, 200)
Beispiel #3
0
    def setUp(self):
        Muncipality(name='Berlin').save()

        self.d1 = District(name='Mitte',
                           muncipality=Muncipality.objects.get(name='Berlin'))
        self.d1.save()

        self.d2 = District(name='Charlottenburg',
                           muncipality=Muncipality.objects.get(name='Berlin'))
        self.d2.save()
        self.user = User.objects.create_user(username='******',
                                             email='*****@*****.**',
                                             password='******')

        self.factory = RequestFactory()
Beispiel #4
0
class CoreViewTestCase(TestCase):

    def setUp(self):
        Muncipality(name='Berlin').save()

        self.d1 = District(
            name='Mitte',
            muncipality=Muncipality.objects.get(name='Berlin')
        )
        self.d1.save()

        self.d2 = District(
            name='Charlottenburg',
            muncipality=Muncipality.objects.get(name='Berlin')
        )
        self.d2.save()
        self.user = User.objects.create_user(
            username='******', email='*****@*****.**', password='******')

        self.factory = RequestFactory()

    def test_view_feeds(self):
        url = reverse('wbc.core.views.feeds')
        resp = Client().get(url)
        self.assertEqual(resp.status_code, 200)

    def test_view_login_success(self):
        url = reverse('wbc.core.views.login_user')
        resp = Client().post(
            url, {'username': self.user.username, 'password': '******'})
        self.assertEqual(resp.status_code, 302)

    def test_view_login_success_next(self):
        url = reverse('wbc.core.views.login_user')
        resp = Client().post(
            url, {'username': self.user.username, 'password': '******', 'next': '/liste'})
        self.assertEqual(resp.status_code, 302)

    def test_view_login_fail(self):
        url = reverse('wbc.core.views.login_user')
        resp = Client().post(
            url, {'username': self.user.username, 'password': ''})
        self.assertEqual(resp.status_code, 200)

    def test_view_logout(self):
        url = reverse('wbc.core.views.logout_user')
        resp = Client().get(url)
        self.assertEqual(resp.status_code, 200)
Beispiel #5
0
    def setUp(self):
        User.objects.create_superuser('admin', 'admin@example', 'admin')

        muncipality = Muncipality(name='Berlin')
        muncipality.save()

        district = District(name='Mitte')
        district.muncipality = muncipality
        district.save()

        process_type = ProcessType(name="ProcessType", description="description")
        process_type.save()

        process_step = ProcessStep(name="ProcessStep", description="description",
                         icon="abc", hover_icon="abc", order=1)
        process_step.process_type = process_type
        process_step.save()

        department = Department(name="Department")
        department.entity = muncipality
        department.save()

        a = Place(
            address='Unter den Linden 1',
            description='Brandenburger Tor',
            lat='-13',
            lon='52',
            identifier='A',
            active=False,
        )
        a.save()
        a.entities.add(district)
        a.save()
        self.place_id = a.pk

        now = datetime.datetime.now()
        p = Publication(
            process_step=process_step,
            description='description',
            place=a,
            begin=now,
            end=now + datetime.timedelta(days=3),
            department=department
        )
        p.save()
        self.publication_id = p.pk
Beispiel #6
0
    def setUp(self):
        Muncipality(name='Berlin').save()

        self.d1 = District(
            name='Mitte',
            muncipality=Muncipality.objects.get(name='Berlin')
        )
        self.d1.save()

        self.d2 = District(
            name='Charlottenburg',
            muncipality=Muncipality.objects.get(name='Berlin')
        )
        self.d2.save()
        self.user = User.objects.create_user(
            username='******', email='*****@*****.**', password='******')

        self.factory = RequestFactory()
Beispiel #7
0
    def setUp(self):

        Muncipality(name="Berlin").save()

        district = District(name="Mitte", muncipality=Muncipality.objects.get(name="Berlin"))
        district.save()

        place = Place(
            address="Unter den Linden 1",
            description="Brandenburger Tor",
            lat="-13",
            lon="52",
            identifier="A",
            active=False,
        )
        place.save()
        place.entities.add(district)
        place.save()
        self.place_id = place.pk
Beispiel #8
0
    def setUp(self):

        Muncipality(name='Berlin').save()

        district = District(name='Mitte',
                            muncipality=Muncipality.objects.get(name='Berlin'))
        district.save()

        place = Place(
            address='Unter den Linden 1',
            description='Brandenburger Tor',
            lat='-13',
            lon='52',
            identifier='A',
            active=False,
        )
        place.save()
        place.entities.add(district)
        place.save()
        self.place_id = place.pk
Beispiel #9
0
    def setUp(self):
        a = Place(
            address='Unter den Linden 1',
            description='Brandenburger Tor',
            lat='-13',
            lon='52',
            identifier='ACB',
            active=False,
        )
        a.save()

        Muncipality(name='Berlin').save()

        d = District(
            name='Mitte',
            muncipality=Muncipality.objects.get(name='Berlin')
        )
        d.save()

        b = District.objects.get(name='Mitte')
        a.entities.add(b)
        a.save()