Skip to content

Commit 6935ac7

Browse files
committed
update encoder
1 parent e41180d commit 6935ac7

File tree

1 file changed

+25
-24
lines changed

1 file changed

+25
-24
lines changed

specs/mixins/encoder_spec.py

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,31 @@
11
import os
2-
from mamba import description, it
3-
from expects import expect, equal
42
from amadeus.mixins.encoder import encode_file_to_base64
53
from amadeus.travel._encoder import from_file, from_base64
64

7-
with description('Mixins/Encoding'):
8-
with it('file should be encoded to base64'):
9-
file = str(os.path.dirname(os.path.abspath(__file__))) \
10-
+ '/encoder_specs_file.eml'
11-
base64 = 'Ym9va2luZw=='
12-
expect(encode_file_to_base64(file)).to(equal(base64))
135

14-
with description('Travel/From File'):
15-
with it('should generate the defined POST body from file'):
16-
file = str(os.path.dirname(os.path.abspath(__file__))) \
17-
+ '/encoder_specs_file.eml'
18-
base64 = 'Ym9va2luZw=='
19-
body = {
20-
'payload': base64,
21-
}
22-
expect(from_file(file)).to(equal(body))
6+
def test_file_encoding():
7+
file = str(os.path.dirname(os.path.abspath(__file__))) \
8+
+ '/encoder_specs_file.eml'
9+
base64 = 'Ym9va2luZw=='
10+
result = encode_file_to_base64(file)
11+
assert result == base64
2312

24-
with description('Travel/From Base64'):
25-
with it('should generate the defined POST body from base64'):
26-
base64 = 'Ym9va2luZw=='
27-
body = {
28-
'payload': base64,
29-
}
30-
expect(from_base64(base64)).to(equal(body))
13+
14+
def test_from_file():
15+
file = str(os.path.dirname(os.path.abspath(__file__))) \
16+
+ '/encoder_specs_file.eml'
17+
base64 = 'Ym9va2luZw=='
18+
body = {
19+
'payload': base64,
20+
}
21+
result = from_file(file)
22+
assert result == body
23+
24+
25+
def test_from_base64():
26+
base64 = 'Ym9va2luZw=='
27+
body = {
28+
'payload': base64,
29+
}
30+
result = from_base64(base64)
31+
assert result == body

0 commit comments

Comments
 (0)