Skip to content

Commit

Permalink
Merge pull request #248 from uktrade/LTD-5022-support-milligrams-unit
Browse files Browse the repository at this point in the history
[LTD-5022] Support milligrams unit for ingested good data
  • Loading branch information
currycoder authored May 24, 2024
2 parents c55928c + d430fcf commit c18a1c9
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
1 change: 1 addition & 0 deletions mail/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ class UnitMapping(enum.Enum):
MTQ = 2 # meters_cubed
MIR = 74 # millilitre
ITG = 30 # intangible
MIM = 111 # milligram

@classmethod
def serializer_choices(cls):
Expand Down
7 changes: 7 additions & 0 deletions mail/tests/files/licence_payload_file
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@
"description": "",
"unit": "NAR",
"quantity": 10.0
},
{
"id": "f95ded2a-354f-46f1-a572-c7f97d63bed2",
"name": "Stock",
"description": "",
"unit": "MIM",
"quantity": 11.0
}
]
}
Expand Down
5 changes: 3 additions & 2 deletions mail/tests/test_end_to_end.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ def test_send_email_to_hmrc_e2e(self, mock_cache):
5\foreignTrader\End User\42 Road, London, Buckinghamshire\\\\\\GB
6\restrictions\Provisos may apply please see licence
7\line\1\\\\\Sporting shotgun\Q\\030\\10\\\\\\
8\end\licence\7
9\fileTrailer\1"""
8\line\2\\\\\Stock\Q\\111\\11.0\\\\\\
9\end\licence\8
10\fileTrailer\1"""
assert body == expected_mail_body # nosec
encoded_reference_code = quote("GBSIEL/2020/0000001/P", safe="")
response = self.client.get(f"{reverse('mail:licence')}?id={encoded_reference_code}")
Expand Down
4 changes: 3 additions & 1 deletion mail/tests/test_enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ def test_convert_code(self):
("MTR", 57),
("LTR", 94),
("MTQ", 2),
("MIR", 74),
("ITG", 30),
("MIM", 111),
]

for code, value in data:
Expand All @@ -26,6 +28,6 @@ def test_convert_none(self):

def test_serializer_choices(self):
choices = UnitMapping.serializer_choices()
expected = ["NAR", "GRM", "KGM", "MTK", "MTR", "LTR", "MTQ", "MIR", "ITG"]
expected = ["NAR", "GRM", "KGM", "MTK", "MTR", "LTR", "MTQ", "MIR", "ITG", "MIM"]

self.assertEqual(choices, expected)
10 changes: 6 additions & 4 deletions mail/tests/test_licence_to_edifact.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ def test_single_siel(self):
+ "\n5\\foreignTrader\\End User\\42 Road, London, Buckinghamshire\\\\\\\\\\\\GB"
+ "\n6\\restrictions\\Provisos may apply please see licence"
+ "\n7\\line\\1\\\\\\\\\\Sporting shotgun\\Q\\\\030\\\\10\\\\\\\\\\\\"
+ "\n8\\end\\licence\\7"
+ "\n9\\fileTrailer\\1\n"
+ "\n8\\line\\2\\\\\\\\\\Stock\\Q\\\\111\\\\11.0\\\\\\\\\\\\"
+ "\n9\\end\\licence\\8"
+ "\n10\\fileTrailer\\1\n"
)

self.assertEqual(result, expected)
Expand Down Expand Up @@ -110,8 +111,9 @@ def test_update_edifact_file(self):
+ "\n7\\foreignTrader\\End User\\42 Road, London, Buckinghamshire\\\\\\\\\\\\GB"
+ "\n8\\restrictions\\Provisos may apply please see licence"
+ "\n9\\line\\1\\\\\\\\\\Sporting shotgun\\Q\\\\030\\\\15\\\\\\\\\\\\"
+ "\n10\\end\\licence\\7"
+ "\n11\\fileTrailer\\2\n"
+ "\n10\\line\\2\\\\\\\\\\Stock\\Q\\\\111\\\\11.0\\\\\\\\\\\\"
+ "\n11\\end\\licence\\8"
+ "\n12\\fileTrailer\\2\n"
)

self.assertEqual(result, expected)
Expand Down

0 comments on commit c18a1c9

Please sign in to comment.