Exemple #1
0
 def test_get_filter_principle_view(self, logged_in_client):
     AgileFactory.create_batch(12, type="value")
     url = reverse("agile:agile-list")
     resp = logged_in_client.get(url, {"type": Agile.TYPE_PRINCIPLE})
     assert resp.status_code == status.HTTP_200_OK
     if len(resp.json()) > 0:
         if "type" in resp.json()[0]:
             assert resp.json()[0]["type"] == Agile.TYPE_PRINCIPLE
Exemple #2
0
 def test_patch(self, logged_in_client):
     """Tests patch request updates the instance."""
     agile_value = AgileFactory.create(type="value")
     url = self.get_detail_url(agile_value.id)
     payload = {"description": "New Description"}
     resp = logged_in_client.patch(url, payload)
     assert resp.status_code == status.HTTP_200_OK
     agile_value = Agile.objects.get(id=resp.json()["id"])
     assert agile_value.description == payload["description"]
Exemple #3
0
 def defaults(self) -> Dict[str, Dict[str, str]]:
     agile_fixture = AgileFactory.create()
     uuid_val = uuid.uuid4()
     data = {
         "name": "Responding to change over following a plan.",
         "description":
         "Circumstances change and sometimes customers demand extra.",
         "uuid": str(uuid_val),
     }
     return {
         "page": agile_fixture,
         "data": data,
     }
Exemple #4
0
 def test_unauthenticated_get_view(self, client):
     """Tests get request are allowed for unauthenticated Users."""
     agile_value = AgileFactory.create(type="value")
     url = self.get_detail_url(agile_value.id)
     resp = client.get(url)
     assert resp.status_code == status.HTTP_200_OK
Exemple #5
0
 def test_get_view(self, logged_in_client):
     agile_value = AgileFactory.create(type="value")
     url = self.get_detail_url(agile_value.id)
     resp = logged_in_client.get(url)
     assert resp.status_code == status.HTTP_200_OK
Exemple #6
0
 def test_uuid_get(self, logged_in_client):
     agile_value = AgileFactory.create(type="value")
     url = self.get_detail_url(agile_value.id)
     resp = logged_in_client.get(url)
     assert resp.status_code == status.HTTP_200_OK
     assert validate_uuid4(resp.json()["uuid"])
Exemple #7
0
 def test_unauthenticated_put(self, client, defaults):
     """Tests post request creates a Agile instance."""
     agile_value = AgileFactory.create(type="value")
     url = self.get_detail_url(agile_value.id)
     resp = client.put(url, defaults["payload"])
     assert resp.status_code == status.HTTP_403_FORBIDDEN
Exemple #8
0
 def test_get_values(self):
     """Tests expected Agile type values from fixtures."""
     AgileFactory.create_batch(4, type="principle")
     AgileFactory.create_batch(3, type="value")
     assert Agile.objects.get_values().count() == 3
Exemple #9
0
 def test_get_or_none(self):
     """Tests expects none."""
     AgileFactory.create_batch(4)
     assert Agile.objects.get_or_none(id=30) is None
Exemple #10
0
 def test_get_or_none_found(self):
     """Tests expected Agile instance."""
     AgileFactory.create_batch(7)
     assert isinstance(Agile.objects.get_or_none(id=1), Agile)