Example #1
0
 def setUp(self):
     super(BulkResultTestCase, self).setUp()
     self.url = reverse('simpl_bulk_api:result-list')
     print(self.url)
     self.period = PeriodFactory()
     self.role = RoleFactory()
     self.view = bulk_views.BulkResultViewSet()
    def test_create(self):
        url = reverse('simpl_api:role-list')

        obj = RoleFactory.build()
        payload = serializers.RoleSerializer(obj).data

        # Does this api work without auth?
        response = self.client.post(url, payload, format='json')
        self.assertEqual(response.status_code, 401)

        # Does this api work with auth?
        with self.login(self.user):
            response = self.client.post(url, payload, format='json')
            self.assertEqual(response.status_code, 201)
            self.assertNotEqual(len(response.data), 0)
    def test_create(self):
        url = reverse("simpl_api:runuser-list")

        obj = RunUserFactory.build(
            run=RunFactory(),
            world=WorldFactory(),
            user=UserFactory(),
            role=RoleFactory(),
        )
        payload = serializers.RunUserSerializer(obj).data

        # Does this api work without auth?
        response = self.client.post(url, payload, format="json")
        self.assertEqual(response.status_code, 401)

        # Does this api work with auth?
        with self.login(self.user):
            response = self.client.post(url, payload, format="json")
            self.assertEqual(response.status_code, 201)
            self.assertNotEqual(len(response.data), 0)
    def setUp(self):
        super(RoleTestCase, self).setUp()

        self.role = RoleFactory()
Example #5
0
 def setUp(self):
     super(BulkDecisionTestCase, self).setUp()
     self.url = reverse('simpl_bulk_api:decision-list')
     self.period = PeriodFactory()
     self.role = RoleFactory()
     self.view = bulk_views.BulkDecisionViewSet()