Passed
Branch master (bc72f6)
by Rafael S.
01:23
created

TestJSONCase0300   A

Complexity

Total Complexity 0

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 0
c 3
b 0
f 0
dl 0
loc 63
rs 10
1
"""Test the JSON interface."""
2
3
from __future__ import absolute_import
4
5
from .test_json import TestJSON
6
7
8
class TestJSONCase0300(TestJSON):
9
    """One operation."""
10
11
    json_input = """{
12
        "subjects": {
13
            "ASST1": {
14
                "type": "Asset",
15
                "name": "Asset 1"
16
            },
17
            "ASST2": {
18
                "type": "Asset",
19
                "name": "Asset 2",
20
                "underlying_assets": {"ASST1":1}
21
            }
22
        },
23
        "occurrences": [
24
            {
25
                "type": "Operation",
26
                "subject": "ASST2",
27
                "date": "2016-01-01",
28
                "quantity": 100,
29
                "price": 1,
30
                "commissions": {},
31
                "raw_results": {},
32
                "operations": []
33
            }
34
        ],
35
        "initial state": {}
36
    }"""
37
38
    json_output = """{
39
        "totals": {
40
            "sales": {
41
                "volume": 0,
42
                "operations": 0
43
            },
44
            "purchases": {
45
                "volume": 100,
46
                "operations": 1
47
            },
48
            "operations": 1,
49
            "daytrades": 0,
50
            "results": {}
51
        },
52
        "assets": {
53
            "ASST2": {
54
                "totals": {
55
                    "sales": 0,
56
                    "purchases": 1,
57
                    "operations": 1,
58
                    "daytrades": 0,
59
                    "results": {}
60
                },
61
                "states": {
62
                    "2016-01-01": {
63
                        "results": {},
64
                        "price": 1.0,
65
                        "quantity": 100
66
                    }
67
                }
68
            }
69
        }
70
    }"""
71