Example #1
0
    def test_report_submit_for_country_within_eu_barrier(self):
        report = MinReportFactory(
            **{
                "term": 2,
                "status": 2,
                "country": "82756b9a-5d95-e211-a939-e4115bead28a",
                "trading_bloc": "",
                "caused_by_trading_bloc": True,
                "trade_direction": 1,
                "sectors_affected": False,
                "product": "Some product",
                "source": "GOVT",
                "title": "Some title",
                "summary": "Some summary",
            })
        report.submit_report()

        url = reverse("get-barrier", kwargs={"pk": report.id})
        response = self.api_client.get(url)

        assert response.status_code == status.HTTP_200_OK
        assert response.data["id"]
        assert response.data["trading_bloc"] is None
        assert response.data["country"][
            "id"] == "82756b9a-5d95-e211-a939-e4115bead28a"
        assert response.data["caused_by_trading_bloc"] is True
Example #2
0
    def test_check_all_fields_after_report_submit_1(self):
        report = MinReportFactory(
            **{
                "term": 2,
                "status": 2,
                "country": "82756b9a-5d95-e211-a939-e4115bead28a",
                "trade_direction": 1,
                "sectors_affected": False,
                "product": "Some product",
                "source": "GOVT",
                "title": "Some title",
                "summary": "Some summary",
            })
        report.submit_report()

        url = reverse("get-barrier", kwargs={"pk": report.id})
        response = self.api_client.get(url)

        assert response.status_code == status.HTTP_200_OK
        assert response.data["id"]
        assert response.data["code"]
        assert 2 == response.data["term"]["id"]
        assert "2020-02-02" == response.data["status_date"]
        assert "Some title" == response.data["title"]
        assert response.data["sectors_affected"] is False
        assert [] == response.data["sectors"]
        assert "82756b9a-5d95-e211-a939-e4115bead28a" == response.data[
            "country"]["id"]
        assert response.data["status"]["id"] == 2
        assert response.data["status_date"]
        assert not response.data["status_summary"]
        assert "UNKNOWN" == response.data["priority"]["code"]
        assert 0 == len(response.data["categories"])
        assert response.data["created_on"]
Example #3
0
    def test_report_submit_for_eu_barrier(self):
        report = MinReportFactory(
            **{
                "term": 2,
                "status": 2,
                "country": None,
                "trading_bloc": "TB00016",
                "trade_direction": 1,
                "sectors_affected": False,
                "product": "Some product",
                "source": "GOVT",
                "title": "Some title",
                "summary": "Some summary",
            })
        report.submit_report()

        url = reverse("get-barrier", kwargs={"pk": report.id})
        response = self.api_client.get(url)

        assert response.status_code == status.HTTP_200_OK
        assert response.data["id"]
        assert "TB00016" == response.data["trading_bloc"]["code"]
        assert response.data["country"] is None