def test_create(self):
        url = reverse('simpl_api:world-list')

        obj = WorldFactory.build(run=RunFactory(), )
        payload = serializers.WorldSerializer(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:scenario-list")

        obj = ScenarioFactory.build(world=WorldFactory())
        payload = serializers.ScenarioSerializer(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(WorldTestCase, self).setUp()

        self.world = WorldFactory()