Skip to content

Commit

Permalink
Merge pull request #271 from uktrade/LTD-5293_Update_UnitMapping_code…
Browse files Browse the repository at this point in the history
…s_to_match_CDS_list

Update UnitMapping codes to match HMRC list
  • Loading branch information
hnryjmes authored Aug 8, 2024
2 parents 67e142a + c71750e commit c2fd08e
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
4 changes: 2 additions & 2 deletions mail/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ class UnitMapping(enum.Enum):
KGM = 23 # kilogram
MTK = 45 # meters_squared
MTR = 57 # meters
LTR = 94 # litre
MTQ = 2 # meters_cubed
LTR = 76 # litre
MTQ = 87 # meters_cubed
MLT = 74 # millilitre
ITG = 30 # intangible
MGM = 111 # milligram
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 @@ -76,6 +76,13 @@
"description": "",
"unit": "MIM",
"quantity": 20.0
},
{
"id": "b642b709-36c7-4010-8e43-e7b8813fbde9",
"name": "A bottle of water",
"description": "",
"unit": "LTR",
"quantity": 1.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 @@ -51,8 +51,9 @@ def test_send_email_to_hmrc_e2e(self, mock_cache):
11\line\5\\\\\Chemical\Q\\110\\20.0\\\\\\
12\line\6\\\\\Chemical\Q\\074\\20.0\\\\\\
13\line\7\\\\\Old Chemical\Q\\111\\20.0\\\\\\
14\end\licence\13
15\fileTrailer\1"""
14\line\8\\\\\A bottle of water\Q\\076\\1.0\\\\\\
15\end\licence\14
16\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: 2 additions & 2 deletions mail/tests/test_enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ def test_convert_code(self):
("KGM", 23),
("MTK", 45),
("MTR", 57),
("LTR", 94),
("MTQ", 2),
("LTR", 76),
("MTQ", 87),
("MLT", 74),
("ITG", 30),
("MGM", 111),
Expand Down
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 @@ -53,8 +53,9 @@ def test_single_siel(self):
+ "\n11\\line\\5\\\\\\\\\\Chemical\\Q\\\\110\\\\20.0\\\\\\\\\\\\"
+ "\n12\\line\\6\\\\\\\\\\Chemical\\Q\\\\074\\\\20.0\\\\\\\\\\\\"
+ "\n13\\line\\7\\\\\\\\\\Old Chemical\\Q\\\\111\\\\20.0\\\\\\\\\\\\"
+ "\n14\\end\\licence\\13"
+ "\n15\\fileTrailer\\1\n"
+ "\n14\\line\\8\\\\\\\\\\A bottle of water\\Q\\\\076\\\\1.0\\\\\\\\\\\\"
+ "\n15\\end\\licence\\14"
+ "\n16\\fileTrailer\\1\n"
)

self.assertEqual(result, expected)
Expand Down Expand Up @@ -122,8 +123,9 @@ def test_update_edifact_file(self):
+ "\n13\\line\\5\\\\\\\\\\Chemical\\Q\\\\110\\\\20.0\\\\\\\\\\\\"
+ "\n14\\line\\6\\\\\\\\\\Chemical\\Q\\\\074\\\\20.0\\\\\\\\\\\\"
+ "\n15\\line\\7\\\\\\\\\\Old Chemical\\Q\\\\111\\\\20.0\\\\\\\\\\\\"
+ "\n16\\end\\licence\\13"
+ "\n17\\fileTrailer\\2\n"
+ "\n16\\line\\8\\\\\\\\\\A bottle of water\\Q\\\\076\\\\1.0\\\\\\\\\\\\"
+ "\n17\\end\\licence\\14"
+ "\n18\\fileTrailer\\2\n"
)

self.assertEqual(result, expected)
Expand Down

0 comments on commit c2fd08e

Please sign in to comment.